本文整理汇总了C++中QMargins::left方法的典型用法代码示例。如果您正苦于以下问题:C++ QMargins::left方法的具体用法?C++ QMargins::left怎么用?C++ QMargins::left使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMargins
的用法示例。
在下文中一共展示了QMargins::left方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintEvent
void LineEdit::paintEvent(QPaintEvent * event)
{
QLineEdit::paintEvent(event);
QPainter p(this);
// draw the default text if needed
bool showDefaultText = text().isEmpty() && !infoText_.isEmpty();
if (showDefaultText) {
p.setPen(Qt::gray);
const QMargins margins = textMargins();
p.drawText(QRect(margins.left() + 8,
margins.top(),
width() - margins.left() - margins.right() - 8,
height() - margins.top() - margins.bottom()),
infoText_,
Qt::AlignLeft | Qt::AlignVCenter);
}
// draw left icon
if (!leftIcon_.isNull()) {
int offset = 1 + (height() - leftIcon_.height() ) / 2;
p.drawPixmap(offset, offset, leftIcon_);
}
// draw right icon
if (!showDefaultText && !rightIcon_.isNull()) {
p.drawPixmap(width() - rightIcon_.width() - 7, 1 + (height() - rightIcon_.height()) / 2, rightIcon_);
}
}
示例2: handleMouseEventWithDecoration
void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
{
if (mWindowDecoration->handleMouse(inputDevice,local,global,b,mods))
return;
QMargins marg = frameMargins();
QRect windowRect(0 + marg.left(),
0 + marg.top(),
geometry().size().width() - marg.right(),
geometry().size().height() - marg.bottom());
if (windowRect.contains(local.toPoint()) || mMousePressedInContentArea != Qt::NoButton) {
QPointF localTranslated = local;
QPointF globalTranslated = global;
localTranslated.setX(localTranslated.x() - marg.left());
localTranslated.setY(localTranslated.y() - marg.top());
globalTranslated.setX(globalTranslated.x() - marg.left());
globalTranslated.setY(globalTranslated.y() - marg.top());
if (!mMouseEventsInContentArea) {
restoreMouseCursor(inputDevice);
QWindowSystemInterface::handleEnterEvent(window());
}
QWindowSystemInterface::handleMouseEvent(window(), timestamp, localTranslated, globalTranslated, b, mods);
mMouseEventsInContentArea = true;
mMousePressedInContentArea = b;
} else {
if (mMouseEventsInContentArea) {
QWindowSystemInterface::handleLeaveEvent(window());
mMouseEventsInContentArea = false;
}
mWindowDecoration->handleMouse(inputDevice,local,global,b,mods);
}
}
示例3: maxMargins
static QMargins maxMargins(const QMargins &a,
const QMargins &b)
{
return QMargins(qMax(a.left(), b.left()),
qMax(a.top(), b.top()),
qMax(a.right(), b.right()),
qMax(a.bottom(), b.bottom()));
}
示例4: resizeEvent
void FrequencyPlotView::resizeEvent(QResizeEvent* event)
{
QGraphicsView::resizeEvent(event);
const QRect rect = viewport()->geometry();
QMargins margins = viewportMargins();
hRuler->setGeometry(rect.x() - margins.left(), rect.y() + rect.height(), rect.width() + margins.left(), margins.bottom());
vRuler->setGeometry(rect.x() - margins.left(), rect.y(), margins.left(), rect.height() + margins.bottom());
}
示例5: calculateMaximumWidth
// Workaround QTCREATORBUG-11653
void calculateMaximumWidth()
{
const QDesktopWidget *desktopWidget = QApplication::desktop();
const int desktopWidth = desktopWidget->isVirtualDesktop()
? desktopWidget->width()
: desktopWidget->availableGeometry(desktopWidget->primaryScreen()).width();
const QMargins widgetMargins = contentsMargins();
const QMargins layoutMargins = layout()->contentsMargins();
const int margins = widgetMargins.left() + widgetMargins.right()
+ layoutMargins.left() + layoutMargins.right();
m_label->setMaximumWidth(desktopWidth - this->pos().x() - margins);
}
示例6: layoutContentsMargins
QRect WWidgetGroup::layoutContentsMargins() const {
QLayout* pLayout = layout();
QMargins margins = pLayout ? pLayout->contentsMargins() :
contentsMargins();
return QRect(margins.left(), margins.top(),
margins.right(), margins.bottom());
}
示例7: setMargins
void HGLayout::setMargins(const QMargins& m)
{
if (layout()) {
layout()->setContentsMargins(m.left(), m.top(), m.right(), m.bottom());
}
HLayout::setMargins(m);
}
示例8: adjustDrawMargins
void Map::adjustDrawMargins(const QMargins &margins) {
mDrawMargins = maxMargins(QMargins(margins.left(),
margins.top() - mTileHeight,
margins.right() - mTileWidth,
margins.bottom()),
mDrawMargins);
}
示例9: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
setupUi(this);
// add the settings slide out panel
controlPanel = new ControlPanel(this->centralWidget());
QMargins mainMargins = m_verticalLayout->contentsMargins();
controlPanel->setLeftMargin(mainMargins.left());
//show the controlPanel
controlPanel->show();
// slide this panel to the top
controlPanel->collapse();
// make sure there is enough room for the controls
int minWidth = controlPanel->frameGeometry().width();
if( minWidth > m_mainSplitter->minimumWidth())
m_mainSplitter->setMinimumWidth(minWidth);
// make sure there is enough space for the collapsed panel
// above all other widgets
int hHeight = controlPanel->hiddenHeight();
qDebug() << Q_FUNC_INFO << "calculated height: " << hHeight;
mainMargins.setTop(hHeight);
m_verticalLayout->setContentsMargins(mainMargins);
m_mainSplitter->installEventFilter(this);
}
示例10: QWidget
QWidget * ExtcapArgumentFileSelection::createEditor(QWidget * parent)
{
QWidget * fileWidget = new QWidget(parent);
QHBoxLayout * editLayout = new QHBoxLayout();
QMargins margins = editLayout->contentsMargins();
editLayout->setContentsMargins(0, 0, 0, margins.bottom());
fileWidget->setContentsMargins(margins.left(), margins.right(), 0, margins.bottom());
QPushButton * button = new QPushButton(UTF8_HORIZONTAL_ELLIPSIS, fileWidget);
textBox = new QLineEdit(_default->toString(), parent);
textBox->setReadOnly(true);
if ( _argument->default_complex != NULL && _argument->arg_type == EXTCAP_ARG_STRING )
textBox->setText(QString().fromUtf8(extcap_complex_get_string(_argument->default_complex)));
if ( _argument->tooltip != NULL )
{
textBox->setToolTip(QString().fromUtf8(_argument->tooltip));
button->setToolTip(QString().fromUtf8(_argument->tooltip));
}
connect(button, SIGNAL(clicked()), (QObject *)this, SLOT(openFileDialog()));
editLayout->addWidget(textBox);
editLayout->addWidget(button);
fileWidget->setLayout(editLayout);
return fileWidget;
}
示例11: saveInSettings
void saveInSettings(QSettings& settingsObj, const QString &name, const QMargins &value)
{
settingsObj.setValue(name + "/left", value.left());
settingsObj.setValue(name + "/top", value.top());
settingsObj.setValue(name + "/right", value.right());
settingsObj.setValue(name + "/bottom", value.bottom());
}
示例12: getLayoutInfo
QString LayoutDumper::getLayoutInfo(QLayout* layout)
{
if (!layout) {
return "null_layout";
}
QMargins margins = layout->contentsMargins();
QSize sizehint = layout->sizeHint();
QSize minsize = layout->minimumSize();
QString name = layout->metaObject()->className();
// usually unhelpful (blank): layout->objectName()
QString margin = QString("margin (l=%1,t=%2,r=%3,b=%4)")
.arg(margins.left())
.arg(margins.top())
.arg(margins.right())
.arg(margins.bottom());
QString constraint = QString("constraint %1")
.arg(toString(layout->sizeConstraint()));
QString sh = QString("sizeHint (%1 x %2)")
.arg(sizehint.width())
.arg(sizehint.height());
QString ms = QString("minimumSize (%7 x %8)")
.arg(minsize.width())
.arg(minsize.height());
QString hfw = layout->hasHeightForWidth() ? " [hasHeightForWidth]" : "";
return QString("%1, %2, %3, %4, %5%6")
.arg(name)
.arg(margin)
.arg(constraint)
.arg(sh)
.arg(ms)
.arg(hfw);
}
示例13: updateBoundingRect
void BrushItem::updateBoundingRect()
{
prepareGeometryChange();
if (!mMapDocument) {
mBoundingRect = QRectF();
return;
}
const QRect bounds = mRegion.boundingRect();
mBoundingRect = mMapDocument->renderer()->boundingRect(bounds);
// Adjust for amount of pixels tiles extend at the top and to the right
if (mTileLayer) {
const Map *map = mMapDocument->map();
QMargins drawMargins = mTileLayer->drawMargins();
drawMargins.setTop(drawMargins.top() - map->tileHeight());
drawMargins.setRight(drawMargins.right() - map->tileWidth());
// Since we're also drawing a tile selection, we should not apply
// negative margins
mBoundingRect.adjust(qMin(0, -drawMargins.left()),
qMin(0, -drawMargins.top()),
qMax(0, drawMargins.right()),
qMax(0, drawMargins.bottom()));
}
}
示例14: setMargins
void KWidget::setMargins( const QMargins& m )
{
QGraphicsLayout *tmpLayout = layout();
if(tmpLayout == NULL)
return;
tmpLayout->setContentsMargins(m.left(), m.top(), m.right(), m.bottom());
}
示例15: sizeHint
QSize TrayIcon::sizeHint() const
{
QMargins margins = contentsMargins();
return QSize(margins.left() + mIconSize.width() + margins.right(),
margins.top() + mIconSize.height() + margins.bottom()
);
}