本文整理汇总了C++中QToolButton::move方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::move方法的具体用法?C++ QToolButton::move怎么用?C++ QToolButton::move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::move方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QLabel
CColorPopup::CColorPopup (QWidget * parent, const char *name, Qt::WFlags f)
:QWidget (parent, name, f)
{
colorShower = new QLabel (this, "color shower");
colorShower->setFrameStyle (Q3Frame::WinPanel | Q3Frame::Sunken);
colorShower->setLineWidth (2);
colorShower->setMidLineWidth (1);
colorShower->resize (37, 20);
colorShower->setPaletteBackgroundColor (QColor (0, 0, 0));
colorShower->move (5, 2);
colorName = new Q3TextEdit (this);
colorName->resize (55, 20);
colorName->move (50, 2);
colorName->setHScrollBarMode (Q3ScrollView::AlwaysOff);
colorName->setVScrollBarMode (Q3ScrollView::AlwaysOff);
QFont f1 ("Times", 8, QFont::Light);
colorName->setFont (f1);
colorName->clearFocus ();
s = new CColorSwatches (this, "", ((CTools *) parent)->dad);
s->resize (210, 125);
s->move (2, 29);
QToolButton * colordialog =new CToolButton (this, tr ("Open color dialog"));
colordialog->move (180, 3);
colordialog->resize (20, 20);
colordialog->setIconSet (QIcon (QPixmap ("colordialogBut.png")));
colordialog->setTextLabel (trUtf8 ("Open Color Dialog"));
connect (colordialog, SIGNAL (clicked ()), this,SLOT (slotColordialog ()));
//setFocusPolicy (QWidget::StrongFocus);
setMouseTracking (true);
mcursor = QPixmap ((const char **) eye_dropper_tool_xpm);
setCursor (QCursor (mcursor, 1, 15));
}
示例2: updateItemWidgets
void NodeTypesDelegate::updateItemWidgets(const QList< QWidget* > widgets, const QStyleOptionViewItem& option, const QPersistentModelIndex& index) const
{
// widgets:
// ColorButton | Title | ID
if (!index.isValid()) {
return;
}
Q_ASSERT(widgets.size() == 4);
KColorButton *colorButton = qobject_cast<KColorButton*>(widgets.at(0));
QLineEdit *title = qobject_cast<QLineEdit*>(widgets.at(1));
QLabel *id = qobject_cast<QLabel*>(widgets.at(2));
QToolButton *propertiesButton = qobject_cast<QToolButton*>(widgets.at(3));
Q_ASSERT(title);
Q_ASSERT(colorButton);
Q_ASSERT(id);
Q_ASSERT(propertiesButton);
colorButton->setColor(index.data(NodeTypeModel::ColorRole).value<QColor>());
title->setText(index.data(NodeTypeModel::TitleRole).toString());
id->setText(index.data(NodeTypeModel::IdRole).toString());
QRect outerRect(0, 0, option.rect.width(), option.rect.height());
QRect contentRect = outerRect.adjusted(m_hPadding, m_vPadding, -m_hPadding, -m_vPadding);
int colorButtonLeftMargin = contentRect.left();
int colorButtonTopMargin = (outerRect.height() - colorButton->height()) / 2;
colorButton->move(colorButtonLeftMargin, colorButtonTopMargin);
int titleLeftMargin = colorButtonLeftMargin + colorButton->width() + 10;
int titleTopMargin = (outerRect.height() - title->height()) / 2;
title->move(titleLeftMargin, titleTopMargin);
// construct remaining from right to left
int propertiesLeftMargin = contentRect.right() - propertiesButton->width() - m_hPadding;
int propertiesTopMargin = (outerRect.height() - propertiesButton->height()) / 2;
propertiesButton->move(propertiesLeftMargin, propertiesTopMargin);
int idLeftMargin = propertiesLeftMargin - id->width() - 10;
int idTopMargin = (outerRect.height() - id->height()) / 2;
id->move(idLeftMargin, idTopMargin);
// title gets remaining space
title->setFixedWidth(qMax(0, idLeftMargin - titleLeftMargin - 10));
}
示例3: RepaintButtons
void ProgressLineEdit::RepaintButtons ()
{
const int frameWidth = style ()->pixelMetric (QStyle::PM_DefaultFrameWidth);
int rightBorder = 0;
int realBorder = 0;
for (int i = VisibleButtons_.count () - 1; i >= 0; --i)
{
QToolButton *btn = VisibleButtons_ [i];
const QSize& bmSz = btn->sizeHint ();
rightBorder += bmSz.width ();
if (i > 0)
realBorder += bmSz.width ();
btn->move (rect ().right () - frameWidth - rightBorder,
(rect ().bottom () + 1 - bmSz.height ()) / 2);
}
const QMargins& margins = textMargins ();
setTextMargins (margins.left (),
margins.top (),
realBorder + frameWidth,
margins.bottom ());
}