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


C++ QListView::setAlternatingRowColors方法代码示例

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


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

示例1: main

int main(int argc, char *argv[])
{
    Q_INIT_RESOURCE(interview);

    QApplication app(argc, argv);
    QSplitter page;

    QAbstractItemModel *data = new Model(1000, 10, &page);
    QItemSelectionModel *selections = new QItemSelectionModel(data);

    QTableView *table = new QTableView;
    table->setModel(data);
    table->setSelectionModel(selections);
    table->horizontalHeader()->setMovable(true);
    table->verticalHeader()->setMovable(true);
    // Set StaticContents to enable minimal repaints on resizes.
    table->viewport()->setAttribute(Qt::WA_StaticContents);
    page.addWidget(table);

    QTreeView *tree = new QTreeView;
    tree->setModel(data);
    tree->setSelectionModel(selections);
    tree->setUniformRowHeights(true);
    tree->header()->setStretchLastSection(false);
    tree->viewport()->setAttribute(Qt::WA_StaticContents);
    // Disable the focus rect to get minimal repaints when scrolling on Mac.
    tree->setAttribute(Qt::WA_MacShowFocusRect, false);
    page.addWidget(tree);

    QListView *list = new QListView;
    list->setModel(data);
    list->setSelectionModel(selections);
    list->setViewMode(QListView::IconMode);
    list->setSelectionMode(QAbstractItemView::ExtendedSelection);
    list->setAlternatingRowColors(false);
    list->viewport()->setAttribute(Qt::WA_StaticContents);
    list->setAttribute(Qt::WA_MacShowFocusRect, false);
    page.addWidget(list);

    page.setWindowIcon(QPixmap(":/images/interview.png"));
    page.setWindowTitle("Interview");
    page.show();

    return app.exec();
}
开发者ID:maxxant,项目名称:qt,代码行数:45,代码来源:main.cpp

示例2: QWidget

AMSamplePlatePre2013Selector::AMSamplePlatePre2013Selector(AMSamplePlatePre2013* sourcePlate, QWidget *parent)
	: QWidget(parent) {

	samplePlateTableName_ = AMDbObjectSupport::s()->tableNameForClass<AMSamplePlatePre2013>();
	// Either use an external plate (if specified in sourcePlate), or make an internal one.
	plate_ = sourcePlate ? sourcePlate : new AMSamplePlatePre2013(this);

	setupUi();
	notesEditor->setObjectName("notesEditor");
	notesEditor->setStyleSheet("#notesEditor { background-image: url(:/notepadBackground.png); font: bold 15px \"Marker Felt\";}");

	AMDetailedItemDelegate* del = new AMDetailedItemDelegate(this);
	// Setting a new view fixes a grayed-menu-background drawing bug on mac
	QListView* lview = new QListView(this);
	lview->setItemDelegate(del);
	lview->setAlternatingRowColors(true);
	plateComboBox->setView(lview);

	notesEditor->setMaximumHeight(80);
	this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

	connect(&plateRefreshScheduler_, SIGNAL(executed()), this, SLOT(populateSamplePlates()));
	plateRefreshScheduler_.schedule();

	onSamplePlateChanged(/*plate_->valid()*/);

	connect(AMDatabase::database("user"), SIGNAL(updated(QString,int)), this, SLOT(onDatabaseUpdated(QString,int)), Qt::QueuedConnection);
	connect(AMDatabase::database("user"), SIGNAL(created(QString,int)), this, SLOT(onDatabaseCreated(QString,int)), Qt::QueuedConnection);
	connect(AMDatabase::database("user"), SIGNAL(removed(QString,int)), this, SLOT(onDatabaseRemoved(QString,int)), Qt::QueuedConnection);

	// GUI event connections
	connect(plateComboBox, SIGNAL(activated(int)), this, SLOT(onComboBoxActivated(int)));
	connect(nameEdit, SIGNAL(textEdited(QString)), this, SLOT(onNameEdited(QString)));
	connect(nameEdit, SIGNAL(editingFinished()), this, SLOT(onPlateEditingFinished()));
	connect(notesEditor, SIGNAL(textChanged()), this, SLOT(onNotesEdited()));
	connect(notesEditor, SIGNAL(editingFinished(int)), this, SLOT(onPlateEditingFinished()));

	notesHeaderButton->setChecked(false);
	notesEditor->setVisible(false);
	connect(notesHeaderButton, SIGNAL(clicked(bool)), notesEditor, SLOT(setVisible(bool)));

	// when our current sample plate is re-loaded out of the database, respond to update the GUI values
	connect(plate_, SIGNAL(loadedFromDb()), this, SLOT(onSamplePlateChanged()), Qt::QueuedConnection);
}
开发者ID:acquaman,项目名称:acquaman,代码行数:44,代码来源:AMSamplePlatePre2013View.cpp


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