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


C++ QToolButton::move方法代码示例

本文整理汇总了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));
}
开发者ID:ozkanpakdil,项目名称:f4l,代码行数:35,代码来源:colorpopup.cpp

示例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));
}
开发者ID:KDE,项目名称:rocs,代码行数:48,代码来源:nodetypesdelegate.cpp

示例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 ());
	}
开发者ID:Akon32,项目名称:leechcraft,代码行数:23,代码来源:progresslineedit.cpp


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