本文整理汇总了C++中QBrush::setMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ QBrush::setMatrix方法的具体用法?C++ QBrush::setMatrix怎么用?C++ QBrush::setMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QBrush
的用法示例。
在下文中一共展示了QBrush::setMatrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint
void TCellViewItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
Q_ASSERT(index.isValid());
const QAbstractItemModel *model = index.model();
Q_ASSERT(model);
QVariant value;
QStyleOptionViewItem opt = option;
// do layout
QImage img = qvariant_cast<QImage>(model->data(index,Qt::DisplayRole));
if (! img.isNull())
painter->drawImage(opt.rect, img);
// draw the background color
value = model->data(index, Qt::BackgroundColorRole);
if (value.isValid()) {
QBrush brush = qvariant_cast<QBrush>(value);
if (brush.gradient()) {
QMatrix m;
m.translate(option.rect.topLeft().x(), option.rect.topLeft().y());
m.scale((float)(option.rect.width())/100.0 , (float)(option.rect.height())/100.0);
brush.setMatrix(m);
painter->fillRect(option.rect, brush);
} else {
painter->fillRect(option.rect, brush);
}
}
// Selection!
if (option.showDecorationSelected && (option.state & QStyle::State_Selected)) {
QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
painter->save();
painter->setPen(QPen(option.palette.brush(cg, QPalette::Highlight), 3));
painter->drawRect(option.rect.adjusted(1,1,-2,-2));
painter->restore();
}
}
示例2: sizePolicy
//.........这里部分代码省略.........
close_button_->setSizePolicy(sizePolicy2);
close_button_->setProperty("CloseButton", QVariant(true));
horizontal_layout_->addWidget(close_button_);
vertical_layout_->addWidget(title_widget_);
stacked_widget_ = new BackgroundWidget(main_widget_, "");
stacked_widget_->setObjectName(QStringLiteral("stacked_widget"));
QPixmap p(":/resources/main_window/pat_100.png");
setBackgroundPixmap(p, true);
//Utils::InterConnector::instance().setMainWindow(this);
get_qt_theme_settings()->setOrLoadDefaultTheme();
vertical_layout_->addWidget(stacked_widget_);
this->setCentralWidget(main_widget_);
logo_->setText(QString());
hide_button_->setText(QString());
maximize_button_->setText(QString());
close_button_->setText(QString());
stacked_widget_->setCurrentIndex(-1);
QMetaObject::connectSlotsByName(this);
if (!get_gui_settings()->get_value(settings_keep_logged_in, true))// || !get_gui_settings()->contains_value(settings_keep_logged_in))
{
showLoginPage();
}
else
{
showMainPage();
}
title_widget_->installEventFilter(event_filter_);
title_->setText("ICQ");
title_->setAttribute(Qt::WA_TransparentForMouseEvents);
logo_->setAttribute(Qt::WA_TransparentForMouseEvents);
setWindowTitle("ICQ");
#ifdef _WIN32
setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint | Qt::WindowMinimizeButtonHint);
fake_parent_window_ = Utils::create_fake_parent_window();
#else
title_widget_->hide();
#endif
title_->setMouseTracking(true);
connect(hide_button_, SIGNAL(clicked()), this, SLOT(minimize()), Qt::QueuedConnection);
connect(maximize_button_, SIGNAL(clicked()), this, SLOT(maximize()), Qt::QueuedConnection);
connect(close_button_, SIGNAL(clicked()), this, SLOT(hideWindow()), Qt::QueuedConnection);
hide_button_->setCursor(Qt::PointingHandCursor);
maximize_button_->setCursor(Qt::PointingHandCursor);
close_button_->setCursor(Qt::PointingHandCursor);
connect(event_filter_, SIGNAL(doubleClick()), this, SLOT(maximize()), Qt::QueuedConnection);
connect(event_filter_, SIGNAL(moveRequest(QPoint)), this, SLOT(moveRequest(QPoint)), Qt::QueuedConnection);
connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipResetComplete()), this, SLOT(onVoipResetComplete()), Qt::QueuedConnection);
connect(Ui::GetDispatcher(), SIGNAL(needLogin()), this, SLOT(showLoginPage()), Qt::DirectConnection);
connect(&Utils::InterConnector::instance(), SIGNAL(showIconInTaskbar(bool)), this, SLOT(showIconInTaskbar(bool)), Qt::QueuedConnection);
connect(this, SIGNAL(needActivate()), this, SLOT(activate()), Qt::QueuedConnection);
connect(get_gui_settings(), SIGNAL(changed(QString)), this, SLOT(guiSettingsChanged(QString)), Qt::QueuedConnection);
QFont f = QApplication::font();
f.setStyleStrategy(QFont::PreferAntialias);
QApplication::setFont(f);
if (platform::is_windows())
{
int shadowWidth = get_gui_settings()->get_shadow_width();
QBrush b = stacked_widget_->palette().background();
QMatrix m;
m.translate(shadowWidth, title_widget_->height() + shadowWidth);
b.setMatrix(m);
Shadow_ = new ShadowWindow(b, shadowWidth);
QPoint pos = mapToGlobal(QPoint(rect().x(), rect().y()));
Shadow_->move(pos.x(), pos.y());
Shadow_->resize(rect().width(), rect().height());
Shadow_->setActive(true);
Shadow_->show();
}
initSettings();
#ifdef _WIN32
DragAcceptFiles((HWND)winId(), TRUE);
#endif //_WIN32
if (!get_gui_settings()->get_value<bool>(settings_show_in_taskbar, true))
hide_taskbar_icon();
#ifdef __APPLE__
mac_support_->enableMacUpdater();
mac_support_->enableMacPreview(this->winId());
#endif
}