QPUSHBUTTON死活不显示啊为啥啊T_T
void CreateSerachTable::SetTable(QString mysqltablename,QList<QString> &titlecolumn,QList<QString> &title,
QList<int> &titlewidth,QList<int> &t,int titlenumber,QFrame *ql)
{
int i = 0;
QStringList temp;
int xtemp=10;
TitleNumber=titlenumber;
Title=title;
TitleColumn=titlecolumn;
TitleWidth=titlewidth;
Type=t;
MysqlTableName=mysqltablename;
SerachOutputTable = new QTableWidget(ql);
SerachOutputTable->setColumnCount(TitleNumber);
SerachOutputTable->setGeometry(QRect(8,140,1342,500));
SerachOutputTable->setHorizontalHeaderLabels(Title);
for(i=0;i<TitleNumber;i++)
{
SerachOutputTable->setColumnWidth(i,TitleWidth[i]);
SerachInputTable.push_back(new QLineEdit(ql));
SerachInputTable[i]->setGeometry(QRect(xtemp,20,TitleWidth[i],40));
xtemp+=TitleWidth[i];
SerachInputTable[i]->setPlaceholderText(Title[i]);
SerachInputTable[i]->setFont(QFont("Ubuntu",20));
QObject::connect(SerachInputTable[i],SIGNAL(textChanged(QString)),this,SLOT(InputtextChanged()));
}
QHeaderView * headerView = (*SerachOutputTable).verticalHeader();
headerView->setHidden(true);
QPushButton addrecord(tr("添加"),ql);
addrecord.show();
ql->show();
addrecord.setGeometry(210,80,200,40);
}
addrecord死活不显示,但其他 SerachOutputTable 和8个SerachInputTable都能显示啊T_T
[解决办法]
QPushButton *addrecord = new QPushButton(tr("添加"),ql);
[解决办法]
再说一点,控件类是要用指针声明来用的
addrecord.setGeometry(210,80,200,40);
你这么写一看就知道是没有用指针声明
你改成指针new后这里也要改
addrecord->setGeometry(210,80,200,40);