本文整理汇总了C++中QTreeView::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeView::resize方法的具体用法?C++ QTreeView::resize怎么用?C++ QTreeView::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeView
的用法示例。
在下文中一共展示了QTreeView::resize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
QApplication app(argc, argv);
//QVBoxLayout lay;
//QWidget wgt;
//lay.addWidget(lbl);
QStringList list;
list << "1" << "2" << "3" << "4";
QStandardItemModel model(3, 3);
QStringList on;
on << "1" << "2" << "3";
QStringList str21;
str21 << "Петя"<< "199"<<"8-916-555-31-4";
model.setHorizontalHeaderLabels(QStringList() << "Имя"<< "Дата" << "телефон" );
for(int top_row = 0; top_row < 3;top_row++){
QModelIndex index1 = model.index(top_row, 0);
QString str1 = QString("ivb-3-1"+QString::number(top_row+3));
//QObject::connect(lbl, SIGNAL(objectNameChanged(QString)),&str1,SLOT),
model.setData(index1,str1);
model.insertRows(0, 3, index1);
model.insertColumns(0, 1, index1);
for(int row = 0; row < 3; row++){
QModelIndex index2 = model.index(row, 0, index1);
QString str2 = QString("student"+QString::number(row+1));
model.setData(index2, str2);
model.insertRows(0, 1, index2);
model.insertColumns(0, 3, index2);
for(int ro = 0; ro < 3; ++ro){
QModelIndex index3 = model.index(0, ro, index2);
model.setData(index3, str21[ro]+QString::number(row+1));
}
}
}
QTreeView treeView;
treeView.setItemDelegate(new SpinBoxDelegate());
treeView.setModel(&model);
treeView.resize(600,600);
treeView.show();
return app.exec();
}
示例2: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QDirModel model;
QTreeView tree;
tree.setModel(&model);
// Demonstrating look and feel features
tree.setAnimated(false);
tree.setIndentation(20);
tree.setSortingEnabled(true);
tree.setWindowTitle(QObject::tr("Dir View"));
tree.resize(640, 480);
tree.show();
return app.exec();
}
示例3: main
int main(int argc, char *argv[])
{
KAboutData aboutData(
"tutorial1",
0,
ki18n("Tutorial 1"),
"1.0",
ki18n("Displays a KMessageBox popup"),
KAboutData::License_GPL,
ki18n("(c) 2007"),
ki18n("Some text..."),
"http://tutorial.com/",
"[email protected]");
KCmdLineArgs::init(argc, argv, &aboutData);
KApplication app;
QSplitter* splitter = new QSplitter();
QDirModel* model = new QDirModel;
QTreeView* tree = new QTreeView(splitter);
tree->setModel(model);
tree->resize(100, 800);
QFrame* frame = new QFrame(splitter);
QBoxLayout* boxLayout = new QVBoxLayout(frame);
QWidget* searchBar = new Pecera::SearchBar();
QWidget* terminal = createTerminalWidget(frame);
boxLayout->addWidget(searchBar);
boxLayout->addWidget(terminal);
frame->resize(600, 500);
//terminal->show();
splitter->resize(700, 500);
splitter->show();
return app.exec();
}
示例4: createWidget
QWidget* WidgetStyle::createWidget(const QString& name)
{
if(name == "CheckBox")
{
QCheckBox* box = new QCheckBox("CheckBox");
box->setObjectName("CheckBox");
return setLayoutWidget({ box }, { 100, 30 });
}
else if(name == "ComboBox")
{
QComboBox* box = new QComboBox;
box->addItem("Item1");
box->addItem("Item3");
box->addItem("Item3");
box->setObjectName("ComboBox");
return setLayoutWidget({ box }, { 70, 30 });
}
else if(name == "DateEdit")
{
QDateEdit* date = new QDateEdit;
date->setObjectName("DateEdit");
return setLayoutWidget({ date }, { 110, 40 });
}
else if(name == "DateTimeEdit")
{
QDateTimeEdit* date = new QDateTimeEdit;
date->setObjectName("DateTimeEdit");
return setLayoutWidget({ date }, { 160, 30 });
}
else if(name == "Dialog")
{
QDialog* dialog = new QDialog;
dialog->setObjectName("Dialog");
return setLayoutWidget({ dialog }, { 160, 110 });
}
else if(name == "DockWidget") //?
{
QDockWidget* widget = new QDockWidget;
widget->setObjectName("DockWidget");
widget->resize(61, 22);
return widget;
}
else if(name == "DoubleSpinBox")
{
QDoubleSpinBox* box = new QDoubleSpinBox;
box->setObjectName("DoubleSpinBox");
return setLayoutWidget({ box }, { 90, 40 });
}
else if(name == "Frame") //??
{
QFrame* frame = new QFrame;
frame->setObjectName("Frame");
frame->resize(150, 100);
return frame;
}
else if(name == "GroupBox")
{
QGroupBox* box = new QGroupBox("GroupBox");
box->setObjectName("GroupBox");
return setLayoutWidget({ box }, { 160, 110 });
}
else if(name == "Label")
{
QLabel* label = new QLabel("Label");
label->setObjectName("Label");
return setLayoutWidget({ label }, { 40, 20});
}
else if(name == "LineEdit")
{
QLineEdit* line = new QLineEdit;
line->setObjectName("LineEdit");
return setLayoutWidget({ line }, { 30, 30 });
}
else if(name == "ListView") //??
{
QListView* view = new QListView;
view->setObjectName("ListView");
view->resize(71, 71);
return view;
}
else if(name == "ListWidget")
{
QListWidget* list = new QListWidget;
list->setObjectName("ListWidget");
for(int i = 0; i < 20; i++)
list->addItem(QString("Item %1").arg(i));
return setLayoutWidget({ list }, { 80, 80 });
}
else if(name == "MainWindow")
{
QMainWindow* window = new QMainWindow;
window->setObjectName("MainWindow");
return setLayoutWidget({ window }, { 160, 110 });
}
else if(name == "Menu")
{
QMenu* parentMenu = new QMenu;
parentMenu->setObjectName("Menu");
parentMenu->addMenu("Menu1");
QMenu* menu1 = parentMenu->addMenu("Menu2");
//.........这里部分代码省略.........