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


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

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


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

示例1: createComboBox

QComboBox* FilterButton::createComboBox(const QStringList& options, const QString& currentOption)
{
	// Stylesheet
	QFile stylefile(":/qss/filterbutton.qss"); stylefile.open(QFile::ReadOnly);
	QString stylesheet(stylefile.readAll());

	filtersComboBox = new QComboBox;

	QListView * listView = new QListView(filtersComboBox);
	filtersComboBox->addItems(options);
	listView->setStyleSheet(stylesheet);


	filtersComboBox->setView(listView);
	filtersComboBox->setStyleSheet(stylesheet);

	// Filter
	filtersComboBox->setCurrentIndex(options.indexOf(currentOption));

	// Connect the combobox's signal to our own
	connect(filtersComboBox, SIGNAL(currentIndexChanged(const QString&)),
			this, SIGNAL(selectionChanged(const QString&)));

	return filtersComboBox;
}
开发者ID:jonongjs,项目名称:auv-vision-system,代码行数:25,代码来源:FilterButton.cpp

示例2: QComboBox

DComboBox::DComboBox(QWidget *parent) :
    QComboBox(parent)
{
    QString style = ""
            "QComboBox {"
                "color:#b4b4b4;"
                "font-size: 14px;"
                "border: 0px solid gray;"
                "border-radius: 3px;"
                "padding: 1px 18px 1px 3px;"
                "min-width: 6em;"
            "}"
            "QComboBox:editable {"
                "background: #232323;"
            "}"
            "QComboBox:!editable, QComboBox::drop-down:editable {"
                "border-image:url(:/ui/images/button_normal.png);"
            "}"
            "/* QComboBox gets the \"on\" state when the popup is open */"
            "QComboBox:!editable:on, QComboBox::drop-down:editable:on {"
                "border-image:url(:/ui/images/button_normal.png);"
            "}"
            "QComboBox:on { /* shift the text when the popup opens */"
                "padding-top: 3px;"
                "padding-left: 4px;"
            "}"
            "QComboBox::drop-down {"
                "subcontrol-origin: padding;"
                "subcontrol-position: top right;"
                "width: 20px;"
                "border-width: 0px;"
                "border-top-right-radius: 3px; /* same radius as the QComboBox */"
                "border-bottom-right-radius: 3px;"
            "}"
            "QComboBox::down-arrow {"
                "image: url(:/ui/images/arrow_down_normal.png);"
            "}"
            "QComboBox::down-arrow:hover {"
                "image: url(:/ui/images/arrow_down_hover.png);"
            "}"
            "QComboBox::down-arrow:on { /* shift the arrow when popup is open */"
                "top: 1px;"
                "left: 1px;"
            "}";
    setStyleSheet(style);

    QListView * listView = new QListView(this);
    style = ""
    "QListView {"
        "color:#b4b4b4;"
        "font-size: 14px;"
        "border: 1px solid #232323;;"
        "alternate-background-color: #232323;"
        "show-decoration-selected: 1;"
        "background: #232323;"
    "}"
    "QListView::item {"
        "border: 0px solid gray;"
        "background: #232323;"
    "}"
    "QListView::item:alternate {"
        "border: 0px solid gray;"
        "background: #232323;"
    "}"
    "QListView::item:selected {"
        "background: #232323;"
        "border: 0px solid #6a6ea9;"
    "}"
    "QListView::item:selected:!active {"
        "border: 0px solid gray;"
        "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
                                    "stop: 0 black, stop: 1 #232323);"
    "}"
    "QListView::item:selected:active {"
        "border: 0px solid gray;"
        "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
                                    "stop: 0 black, stop: 1 #232323);"
    "}"
    "QListView::item:hover {"
        "border: 0px solid gray;"
        "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
                                    "stop: 0 black, stop: 1 #232323);"
    "}";
    listView->setStyleSheet(style);

    this->setView(listView);
}
开发者ID:LightCity,项目名称:deepin-boot-maker,代码行数:87,代码来源:dcombobox.cpp

示例3: QTabWidget

QgsWelcomePage::QgsWelcomePage( QWidget* parent )
    : QTabWidget( parent )
{
  QVBoxLayout* mainLayout = new QVBoxLayout;
  mainLayout->setMargin( 0 );
  setLayout( mainLayout );

  QHBoxLayout* layout = new QHBoxLayout();
  layout->setMargin( 9 );

  mainLayout->addLayout( layout );

  QWidget* recentProjctsContainer = new QWidget;
  recentProjctsContainer->setLayout( new QVBoxLayout );
  QLabel* recentProjectsTitle = new QLabel( QString( "<h1>%1</h1>" ).arg( tr( "Recent Projects" ) ) );
  recentProjctsContainer->layout()->addWidget( recentProjectsTitle );

  QListView* recentProjectsListView = new QListView();
  mModel = new QgsWelcomePageItemsModel( recentProjectsListView );
  recentProjectsListView->setModel( mModel );
  recentProjectsListView->setStyleSheet( "QListView::item {"
                                         "  margin-top: 5px;"
                                         "  margin-bottom: 5px;"
                                         "  margin-left: 15px;"
                                         "  margin-right: 15px;"
                                         "  border-width: 1px;"
                                         "  border-color: #999;"
                                         "  border-radius: 9px;"
                                         "  background: #eee;"
                                         "  padding: 10px;"
                                         "}"
                                         "QListView::item:selected:active {"
                                         "  background: #aaaaaa;"
                                         "}" );

  recentProjctsContainer->layout()->addWidget( recentProjectsListView );

  addTab( recentProjctsContainer, "Recent Projects" );

  QWidget* whatsNewContainer = new QWidget;
  whatsNewContainer->setLayout( new QVBoxLayout );
  QLabel* whatsNewTitle = new QLabel( QString( "<h1>%1</h1>" ).arg( tr( "QGIS News" ) ) );
  whatsNewContainer->layout()->addWidget( whatsNewTitle );

  QgsWebView* whatsNewPage = new QgsWebView();
  whatsNewPage->setUrl( QUrl::fromLocalFile( QgsApplication::whatsNewFilePath() ) );
  whatsNewPage->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
  whatsNewPage->setContextMenuPolicy( Qt::NoContextMenu );
  whatsNewPage->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
  whatsNewPage->setStyleSheet( "background:transparent" );
  whatsNewPage->setAttribute( Qt::WA_TranslucentBackground );

  whatsNewContainer->layout()->addWidget( whatsNewPage );
//  whatsNewContainer->setMaximumWidth( 250 );
//  whatsNewContainer->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
  addTab( whatsNewContainer, "News" );

  connect( whatsNewPage, SIGNAL( linkClicked( QUrl ) ), this, SLOT( whatsNewLinkClicked( QUrl ) ) );

  mVersionInformation = new QLabel;
  mainLayout->addWidget( mVersionInformation );
  mVersionInformation->setVisible( false );

  mVersionInfo = new QgsVersionInfo();
  connect( mVersionInfo, SIGNAL( versionInfoAvailable() ), this, SLOT( versionInfoReceived() ) );
  mVersionInfo->checkVersion();

  connect( recentProjectsListView, SIGNAL( activated( QModelIndex ) ), this, SLOT( itemActivated( QModelIndex ) ) );
}
开发者ID:redwoodxiao,项目名称:QGIS,代码行数:69,代码来源:qgswelcomepage.cpp


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