当前位置: 首页>>代码示例>>C++>>正文


C++ QTreeView::resize方法代码示例

本文整理汇总了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();
}
开发者ID:Xambey,项目名称:learning,代码行数:51,代码来源:main.cpp

示例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();
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:19,代码来源:main.cpp

示例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();
}
开发者ID:mrobinson,项目名称:pecera,代码行数:36,代码来源:TestUI.cpp

示例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");
//.........这里部分代码省略.........
开发者ID:kissofblood,项目名称:September,代码行数:101,代码来源:widgetstyle.cpp


注:本文中的QTreeView::resize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。