コード例 #1
0
ファイル: validationItem.C プロジェクト: HeyJJ/ball
		void ValidationItem::init()
		{
			result_color_ = QColor(205,225,205);
			initName();
			setPixmap(findPixmap("validation"));
			createActions();
			coeff_stderr_ratio_ = 0;
			plotter_ = NULL;
		}
コード例 #2
0
ファイル: findtext.cpp プロジェクト: DanMan/quiterss
FindTextContent::FindTextContent(QWidget *parent)
  : QLineEdit(parent)
{
  findInNewsAct_ = new QAction(this);
  findInNewsAct_->setObjectName("findInNewsAct");
  findInNewsAct_->setIcon(QIcon(":/images/findInNews"));
  findInNewsAct_->setCheckable(true);
  findInNewsAct_->setChecked(true);

  findTitleAct_ = new QAction(this);
  findTitleAct_->setObjectName("findTitleAct");
  findTitleAct_->setIcon(QIcon(":/images/findInNews"));
  findTitleAct_->setCheckable(true);
  findAuthorAct_ = new QAction(this);
  findAuthorAct_->setObjectName("findAuthorAct");
  findAuthorAct_->setIcon(QIcon(":/images/findInNews"));
  findAuthorAct_->setCheckable(true);
  findCategoryAct_ = new QAction(this);
  findCategoryAct_->setObjectName("findCategoryAct");
  findCategoryAct_->setIcon(QIcon(":/images/findInNews"));
  findCategoryAct_->setCheckable(true);
  findContentAct_ = new QAction(this);
  findContentAct_->setObjectName("findContentAct");
  findContentAct_->setIcon(QIcon(":/images/findInNews"));
  findContentAct_->setCheckable(true);
  findLinkAct_ = new QAction(this);
  findLinkAct_->setObjectName("findLinkAct");
  findLinkAct_->setIcon(QIcon(":/images/findInNews"));
  findLinkAct_->setCheckable(true);

  findInBrowserAct_ = new QAction(this);
  findInBrowserAct_->setObjectName("findInBrowserAct");
  findInBrowserAct_->setIcon(QIcon(":/images/findText"));
  findInBrowserAct_->setCheckable(true);

  findGroup_ = new QActionGroup(this);
  findGroup_->setExclusive(true);
  findGroup_->addAction(findInNewsAct_);
  findGroup_->addAction(findTitleAct_);
  findGroup_->addAction(findAuthorAct_);
  findGroup_->addAction(findCategoryAct_);
  findGroup_->addAction(findContentAct_);
  findGroup_->addAction(findLinkAct_);
  findGroup_->addAction(findInBrowserAct_);

  findMenu_ = new QMenu(this);
  findMenu_->addActions(findGroup_->actions());
  findMenu_->insertSeparator(findTitleAct_);
  findMenu_->insertSeparator(findInBrowserAct_);

  findButton_ = new QToolButton(this);
  findButton_->setFocusPolicy(Qt::NoFocus);
  QPixmap findPixmap(":/images/selectFindInNews");
  findButton_->setIcon(QIcon(findPixmap));
  findButton_->setIconSize(findPixmap.size());
  findButton_->setCursor(Qt::ArrowCursor);
  findButton_->setStyleSheet("QToolButton { border: none; padding: 0px; }");

  connect(findButton_, SIGNAL(clicked()), this, SLOT(slotMenuFind()));
  connect(findGroup_, SIGNAL(triggered(QAction*)),
          this, SLOT(slotSelectFind(QAction*)));

  clearButton_ = new QToolButton(this);
  clearButton_->setFocusPolicy(Qt::NoFocus);
  QPixmap pixmap(":/images/editClear");
  clearButton_->setIcon(QIcon(pixmap));
  clearButton_->setIconSize(pixmap.size());
  clearButton_->setCursor(Qt::ArrowCursor);
  clearButton_->setStyleSheet("QToolButton { border: none; padding: 0px; }");
  clearButton_->hide();
  connect(clearButton_, SIGNAL(clicked()), this, SLOT(slotClear()));
  connect(this, SIGNAL(textChanged(const QString&)),
          SLOT(updateClearButton(const QString&)));

  findLabel_ = new QLabel(tr("Find in News"), this);
  findLabel_->setStyleSheet("QLabel { color: gray; }");

  int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
  setStyleSheet(QString("QLineEdit { padding-right: %1px; padding-left: %2px; }").
                arg(clearButton_->sizeHint().width() + frameWidth + 1).
                arg(findButton_->sizeHint().width() + frameWidth + 1));
  QSize msz = minimumSizeHint();
  setMinimumSize(
        qMax(msz.width(), clearButton_->sizeHint().height() + findButton_->sizeHint().height() + frameWidth * 2 + 2),
        qMax(msz.height(), clearButton_->sizeHint().height() + frameWidth * 2 + 2));
}