example of QGridLayout

#include "find.h" #include<QtGui> //find.cpp //example of QGridLayout class QLabel; class QPushButton; class QCheckBox; class QTableWidget; findDialog::findDialog(QWidget *parent):QDialog(parent) { QLabel* nameLabel=new QLabel(tr("&nameLabel:"),this); QLabel* lookInLabel=new QLabel(tr("&look in:"),this); QLabel* statusLabel=new QLabel(tr("0 file found"),this); QLineEdit* nameEdit=new QLineEdit(this); QLineEdit* lookInEdit=new QLineEdit(this); QPushButton* find=new QPushButton(tr("&find"),this); QPushButton* cancel=new QPushButton(tr("&cancel"),this); QCheckBox* subFolder=new QCheckBox(tr("subfolder &include"),this); lookInLabel->setBuddy(lookInEdit); nameLabel->setBuddy(nameEdit); QTableWidget* table=new QTableWidget(5,3,this); QStringList tLabel; tLabel<<tr("name")<<tr("size")<<tr("modify"); table->setHorizontalHeaderLabels(tLabel); QObject::connect(find,SIGNAL(clicked()),this,SLOT(accept())); QObject::connect(cancel,SIGNAL(clicked()),this,SLOT(reject())); QGridLayout* gridLayout=new QGridLayout; gridLayout->addWidget(nameLabel,0,0); gridLayout->addWidget(nameEdit,0,1); gridLayout->addWidget(find,0,2); gridLayout->addWidget(cancel,1,2); gridLayout->addWidget(lookInLabel,1,0); gridLayout->addWidget(lookInEdit,1,1); gridLayout->addWidget(subFolder,2,0,1,2); gridLayout->addWidget(statusLabel,4,0); gridLayout->addWidget(table,3,0,1,2); setLayout(gridLayout); setWindowTitle(tr("Find Files or Folders")); }

 

example of QGridLayout_第1张图片

 


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/thmono/archive/2009/12/12/4992607.aspx

你可能感兴趣的:(File,table,Class,include,Signal)