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


C++ QTableView::setObjectName方法代码示例

本文整理汇总了C++中QTableView::setObjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QTableView::setObjectName方法的具体用法?C++ QTableView::setObjectName怎么用?C++ QTableView::setObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTableView的用法示例。


在下文中一共展示了QTableView::setObjectName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QListView

/*!
    Return a new viewType.
 */
QAbstractItemView *ViewsToTest::createView(const QString &viewType)
{
    QAbstractItemView *view = 0;
    if (viewType == "QListView_ScrollPerItem") {
        view = new QListView();
        view->setObjectName("QListView");
        view->setHorizontalScrollMode(QAbstractItemView::ScrollPerItem);
        view->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
    } else if (viewType == "QListView_ScrollPerPixel") {
        view = new QListView();
        view->setObjectName("QListView");
        view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
        view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    } else if (viewType == "QHeaderViewHorizontal") {
        view = new QHeaderView(Qt::Horizontal);
        view->setObjectName("QHeaderView");
    } else if (viewType == "QHeaderViewVertical") {
        view = new QHeaderView(Qt::Vertical);
        view->setObjectName("QHeaderView");
    } else if (viewType == "QTableView_ScrollPerItem") {
        view = new QTableView();
        view->setObjectName("QTableView");
        view->setHorizontalScrollMode(QAbstractItemView::ScrollPerItem);
        view->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
    } else if (viewType == "QTableView_ScrollPerPixel") {
        view = new QTableView();
        view->setObjectName("QTableView");
        view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
        view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    } else if (viewType == "QTableViewNoGrid") {
        QTableView *table = new QTableView();
        table->setObjectName("QTableView");
        table->setShowGrid(false);
        view = table;
    } else if (viewType == "QTreeView_ScrollPerItem") {
        view = new QTreeView();
        view->setObjectName("QTreeView");
        view->setHorizontalScrollMode(QAbstractItemView::ScrollPerItem);
        view->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
        view->setSelectionBehavior(QAbstractItemView::SelectItems);
    } else if (viewType == "QTreeView_ScrollPerPixel") {
        view = new QTreeView();
        view->setObjectName("QTreeView");
        view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
        view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
        view->setSelectionBehavior(QAbstractItemView::SelectItems);
    }
    Q_ASSERT(view);
    return view;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:53,代码来源:viewstotest.cpp

示例2: 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

示例3: setupUi


//.........这里部分代码省略.........
		streetHLayout->addWidget(streetLineEdit);
		streetHLayout->addWidget(numberLabel);
		streetHLayout->addWidget(numberLineEdit);
		streetHLayout->setContentsMargins(0, 0, 0, 0);
		streetHLayout->setStretch(0, 5);
		streetHLayout->setStretch(2, 1);

		// zip and city in one cell like above
		cityHLayout->addWidget(zipLineEdit);
		cityHLayout->addWidget(cityLabel);
		cityHLayout->addWidget(cityLineEdit);
		cityHLayout->setContentsMargins(0, 0, 0, 0);

		// title and titleext like above
		titleHLayout->addWidget(comboBox);
		titleHLayout->addWidget(titleExtLabel);
		titleHLayout->addWidget(titleExtLineEdit);
		titleHLayout->setContentsMargins(0, 0, 0, 0);

		// zip codes have only 5 digits, also define appropriate size
		zipLineEdit->setMaxLength(5);
		zipLineEdit->setMaximumSize(QSize(80, 16777215));


		// initial siye of dialog. TODO: Save in conf on quit. Restore here.
		MemberEditDialog->resize(1200, 700);
		updateGeometry();


		retranslateUi(MemberEditDialog);

		QMetaObject::connectSlotsByName(MemberEditDialog);
		if (MemberEditDialog->objectName().isEmpty())
			MemberEditDialog->setObjectName(QStringLiteral("MemberEditDialog"));

		mainWidget->setObjectName(QStringLiteral("mainWidget"));
		horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
		tabWidget->setObjectName(QStringLiteral("tabWidget"));
		generalTab->setObjectName(QStringLiteral("generalTab"));
		generalHLayout->setObjectName(QStringLiteral("generalHLayout"));
		formWidget->setObjectName(QStringLiteral("formWidget"));
		formTab1LeftLayout->setObjectName(QStringLiteral("formTab1LeftLayout"));
		titleLabel->setObjectName(QStringLiteral("titleLabel"));
		firstNameLabel->setObjectName(QStringLiteral("firstNameLabel"));
		firstNameLineEdit->setObjectName(QStringLiteral("firstNameLineEdit"));
		lastNameLabel->setObjectName(QStringLiteral("lastNameLabel"));
		lastNameLineEdit->setObjectName(QStringLiteral("lastNameLineEdit"));
		streetLabel->setObjectName(QStringLiteral("streetLabel"));
		zipLabel->setObjectName(QStringLiteral("zipLabel"));
		streetHorizontalWidget->setObjectName(QStringLiteral("streetHorizontalWidget"));
		streetHLayout->setObjectName(QStringLiteral("streetHLayout"));
		streetLineEdit->setObjectName(QStringLiteral("streetLineEdit"));
		numberLabel->setObjectName(QStringLiteral("numberLabel"));
		numberLineEdit->setObjectName(QStringLiteral("numberLineEdit"));
		cityHorizontalWidget->setObjectName(QStringLiteral("cityHorizontalWidget"));
		cityHLayout->setObjectName(QStringLiteral("cityHLayout"));
		zipLineEdit->setObjectName(QStringLiteral("zipLineEdit"));
		cityLabel->setObjectName(QStringLiteral("cityLabel"));
		cityLineEdit->setObjectName(QStringLiteral("cityLineEdit"));
		titleHorizontalWidget->setObjectName(QStringLiteral("titleHorizontalWidget"));
		titleHLayout->setObjectName(QStringLiteral("titleHLayout"));
		comboBox->setObjectName(QStringLiteral("comboBox"));
		titleExtLabel->setObjectName(QStringLiteral("titleExtLabel"));
		titleExtLineEdit->setObjectName(QStringLiteral("titleExtLineEdit"));
		formTab1Right->setObjectName(QStringLiteral("formTab1Right"));
		formTab1RightLayout->setObjectName(QStringLiteral("formTab1RightLayout"));
开发者ID:brainpower,项目名称:VManager,代码行数:67,代码来源:membereditdialog_ui.hpp


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