本文整理汇总了C++中QSize::rwidth方法的典型用法代码示例。如果您正苦于以下问题:C++ QSize::rwidth方法的具体用法?C++ QSize::rwidth怎么用?C++ QSize::rwidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSize
的用法示例。
在下文中一共展示了QSize::rwidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotSharesFetched
void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
{
QScrollArea *scrollArea = _ui->scrollArea;
auto newViewPort = new QWidget(scrollArea);
auto layout = new QVBoxLayout(newViewPort);
QSize minimumSize = newViewPort->sizeHint();
int x = 0;
foreach(const auto &share, shares) {
// We don't handle link shares
if (share->getShareType() == Share::TypeLink) {
continue;
}
ShareWidget *s = new ShareWidget(share, _isFile, _ui->scrollArea);
connect(s, SIGNAL(resizeRequested()), this, SLOT(slotAdjustScrollWidgetSize()));
layout->addWidget(s);
x++;
if (x <= 3) {
minimumSize = newViewPort->sizeHint();
} else {
minimumSize.rwidth() = qMax(newViewPort->sizeHint().width(), minimumSize.width());
}
}
minimumSize.rwidth() += layout->spacing();
minimumSize.rheight() += layout->spacing();
scrollArea->setMinimumSize(minimumSize);
scrollArea->setVisible(!shares.isEmpty());
scrollArea->setWidget(newViewPort);
}
示例2: sizeHint
QSize TrackViewDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QSize res = QStyledItemDelegate::sizeHint(option, index);
if (!index.parent().isValid())
{
if (!mDiskHeightHint)
{
int h = 8;
QPainter painter(mTrackView);
QFont titleFont = this->titleFont(&painter);
QFont filesFont = this->filesFont(&painter);
h += QFontMetrics(titleFont).height();
h += QFontMetrics(filesFont).height() * 2;
mDiskHeightHint = qMax(IMG_HEIGHT, h) + 2 * MARGIN + BOTTOM_PADDING; //For Line
}
res.rheight() = mDiskHeightHint;
if (index.row())
res.rheight() += TOP_PADDING;
if (index.column() == 0)
res.rwidth() = 600;
else
res.rwidth() = 0;
}
else
{
res.rheight() = res.height() + 8;
}
return res;
}
示例3: wheelEvent
void MultiLayer::wheelEvent(QWheelEvent *e) {
QApplication::setOverrideCursor(Qt::waitCursor);
bool resize = false;
QPoint aux;
QSize intSize;
Graph *resize_graph = 0;
// Get the position of the mouse
int xMouse = e->x();
int yMouse = e->y();
for (int i = 0; i < (int)graphsList.count(); i++) {
Graph *gr = (Graph *)graphsList.at(i);
intSize = gr->plotWidget()->size();
aux = gr->pos();
if (xMouse > aux.x() && xMouse < (aux.x() + intSize.width())) {
if (yMouse > aux.y() && yMouse < (aux.y() + intSize.height())) {
resize_graph = gr;
resize = TRUE;
}
}
}
if (resize &&
(e->state() == Qt::AltButton || e->state() == Qt::ControlButton ||
e->state() == Qt::ShiftButton)) {
intSize = resize_graph->plotWidget()->size();
// If alt is pressed then change the width
if (e->state() == Qt::AltButton) {
if (e->delta() > 0) {
intSize.rwidth() += 5;
} else if (e->delta() < 0) {
intSize.rwidth() -= 5;
}
}
// If crt is pressed then changed the height
else if (e->state() == Qt::ControlButton) {
if (e->delta() > 0) {
intSize.rheight() += 5;
} else if (e->delta() < 0) {
intSize.rheight() -= 5;
}
}
// If shift is pressed then resize
else if (e->state() == Qt::ShiftButton) {
if (e->delta() > 0) {
intSize.rwidth() += 5;
intSize.rheight() += 5;
} else if (e->delta() < 0) {
intSize.rwidth() -= 5;
intSize.rheight() -= 5;
}
}
aux = resize_graph->pos();
resize_graph->setGeometry(QRect(QPoint(aux.x(), aux.y()), intSize));
resize_graph->plotWidget()->resize(intSize);
emit modifiedPlot();
}
QApplication::restoreOverrideCursor();
}
示例4: sectionSizeFromContents
QSize FilterHorizontalHeaderView::sectionSizeFromContents(int logicalIndex) const
{
QVariant variant = model()->headerData(logicalIndex, Qt::Horizontal, Qt::SizeHintRole);
if (variant.isValid())
return qvariant_cast<QSize>(variant);
// otherwise use the contents
QStyleOptionHeader opt;
initStyleOption(&opt);
opt.section = logicalIndex;
QVariant var = model()->headerData(logicalIndex, Qt::Horizontal,
Qt::FontRole);
QFont fnt;
if (var.isValid() && var.canConvert<QFont>())
fnt = qvariant_cast<QFont>(var);
else
fnt = font();
fnt.setBold(true);
opt.fontMetrics = QFontMetrics(fnt);
opt.text = model()->headerData(logicalIndex, Qt::Horizontal,
Qt::DisplayRole).toString();
variant = model()->headerData(logicalIndex, Qt::Horizontal, Qt::DecorationRole);
opt.icon = qvariant_cast<QIcon>(variant);
if (opt.icon.isNull())
opt.icon = qvariant_cast<QPixmap>(variant);
QSize size = style()->sizeFromContents(QStyle::CT_HeaderSection, &opt, QSize(), this);
/*if (isSortIndicatorShown() && sortIndicatorSection() == logicalIndex) {
int margin = style()->pixelMetric(QStyle::PM_HeaderMargin, &opt, this);
if (Qt::Horizontal == Qt::Horizontal)
size.rwidth() += size.height() + margin;
else
size.rheight() += size.width() + margin;
}*/
size.rwidth()=std::max(size.rwidth(),40);
return size;
}
示例5: sizeHint
QSize SearchItemDelegate::sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
QStyleOptionViewItem opt(option);
QStyle *style = opt.widget->style();
QSize size = QStyledItemDelegate::sizeHint(opt, index);
size.setWidth(0);
const int margin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, &opt, opt.widget) + 1;
// Find decoration roles with data present.
QList<int> roles;
for (int role : m_decorationRoles) {
if (!index.data(role).isNull())
roles.append(role);
}
if (!roles.isEmpty()) {
const QIcon icon = index.data(roles.first()).value<QIcon>();
const QSize actualSize = icon.actualSize(opt.decorationSize);
const int decorationWidth = std::min(opt.decorationSize.width(), actualSize.width());
size.rwidth() = (decorationWidth + margin) * roles.size() + margin;
}
size.rwidth() += opt.fontMetrics.width(index.data().toString()) + margin * 2;
return size;
}
示例6: updateConsoleSize
void QConsolePrivate::updateConsoleSize (bool sync)
{
QFontMetrics fm (m_consoleView->font());
QSize winSize = m_consoleView->size ();
m_charSize.rwidth () = fm.averageCharWidth();
m_charSize.rheight () = fm.lineSpacing ();
m_consoleRect.setWidth (int(double(winSize.width ()) / double(fm.averageCharWidth())));
m_consoleRect.setHeight (int(double(winSize.height ()) / double(fm.lineSpacing ())));
m_bufferSize.rwidth () = m_consoleRect.width ();
m_bufferSize.rheight () = qMax (m_bufferSize.height (),
m_consoleRect.height ());
m_consoleRect.moveLeft (0);
if (m_consoleRect.bottom () >= m_bufferSize.height ())
m_consoleRect.moveTop (m_bufferSize.height () - m_consoleRect.height ());
log ("Console resized:\n");
log (" widget size: %d x %d\n", winSize.width (), winSize.height ());
log (" buffer size: %d x %d\n", m_bufferSize.width (),
m_bufferSize.height ());
log (" window: (%d, %d) -> (%d, %d) [%d x %d]\n",
m_consoleRect.left (), m_consoleRect.top (),
m_consoleRect.right (), m_consoleRect.bottom (),
m_consoleRect.width (), m_consoleRect.height ());
if (sync)
syncConsoleParameters ();
updateScrollBar ();
}
示例7: style
//=============================================================================
int sstQt01PathPaintWidgetCls::updateButtonGeometry(QToolButton *button, int x, int y)
{
QSize size = button->sizeHint();
button->setGeometry(x - size.rwidth(), y - size.rheight(),
size.rwidth(), size.rheight());
return y - size.rheight()
- style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
}
示例8: segmentSizeFromContents
static QSize segmentSizeFromContents(const QStyleOption *option, const QSize &contentSize)
{
QSize ret = contentSize;
if (const QtStyleOptionSegmentControlSegment *segment
= static_cast<const QtStyleOptionSegmentControlSegment *>(option)) {
ret.rwidth() += 20;
ret.rheight() += 10;
if (!segment->icon.isNull())
ret.rwidth() += 5;
}
return ret;
}
示例9: sizeHint
QSize QIrParabolicEffectManager::sizeHint() const
{
QIR_P(const QIrParabolicEffectManager);
QIrDockView * view = p->view;
QList< QIrDockletBundle * > list = view->bundles();
QIrDock * dock = view->dock();
QRectF bounding;
QRectF geom;
int sepCount = 0, count = list.count();
QIrDockStyle * style = dock->dockStyle();
int spacing = p->view->dockletSpacing();
if ( !style )
return QSize();
bounding = contentRect();
for (int i = 0; i < count; i++) {
if ( list[i]->docklet()->isSeparator() )
sepCount++;
}
QSize s = bounding.size().toSize();
if ( !dock->isExtended() ) {
QSize mindockletSize = sizeForIconSize(style,spacing,dock->effectiveMinimumIconSize(),dock->minimumIconSize(),dock->maximumIconSize(),false,dock->orientation());
QSize minSepSize = sizeForIconSize(style,spacing,dock->effectiveMinimumIconSize(),dock->minimumIconSize(),
dock->maximumIconSize(),true,dock->orientation());
if ( dock->orientation() == Qt::Horizontal ) {
s.rwidth() = (count - sepCount) * (mindockletSize.width() + 1) + sepCount * (minSepSize.width() + 1) - 1;
} else {
s.rheight() = (count - sepCount) * (mindockletSize.height() + 1) + sepCount * (minSepSize.height() + 1) - 1;
}
}
return s;
}
示例10: update
void WelcomeScreen::update()
{
// find dimensions
int max_x = 0;
int max_y = 0;
for (Buttons::const_iterator i = m_buttons.constBegin();
i != m_buttons.constEnd();
++i) {
if (i.key().x > max_x) {
max_x = i.key().x;
}
if (i.key().y > max_y) {
max_y = i.key().y;
}
}
max_x++;
max_y++;
// place buttons
QSize size = m_size;
size.rwidth() /= max_x;
size.rheight() /= max_y;
for (Buttons::const_iterator i = m_buttons.constBegin();
i != m_buttons.constEnd();
++i) {
QPoint pos(size.width() * i.key().x,
size.height() * i.key().y);
QPoint delta((size.width() - i.value()->size().width()) / 2,
(size.height() - i.value()->size().height()) / 2);
i.value()->moveTo(pos + delta);
i.value()->repaint();
}
}
示例11: foreach
/* Search for the maximum available size-hint */
foreach (QIWizardPage *pPage, pages)
{
maxOfSizeHints.rwidth() = pPage->sizeHint().width() > maxOfSizeHints.width() ?
pPage->sizeHint().width() : maxOfSizeHints.width();
maxOfSizeHints.rheight() = pPage->sizeHint().height() > maxOfSizeHints.height() ?
pPage->sizeHint().height() : maxOfSizeHints.height();
}
示例12: requestPixmap
QPixmap MLocalThemeDaemonClient::requestPixmap(const QString &id, const QSize &requestedSize)
{
QPixmap pixmap;
QSize size = requestedSize;
if (size.width() < 1) {
size.rwidth() = 0;
}
if (size.height() < 1) {
size.rheight() = 0;
}
const PixmapIdentifier pixmapId(id, size);
pixmap = m_pixmapCache.value(pixmapId);
if (pixmap.isNull()) {
// The pixmap is not cached yet. Decode the image and
// store it into the cache as pixmap.
const QImage image = readImage(id);
if (!image.isNull()) {
pixmap = QPixmap::fromImage(image);
if (requestedSize.isValid() && (pixmap.size() != requestedSize)) {
pixmap = pixmap.scaled(requestedSize);
}
m_pixmapCache.insert(pixmapId, pixmap);
}
}
return pixmap;
}
示例13: calculateSize
QSize XKPPlacementLayout::calculateSize(SizeType sizeType) const
{
#ifdef DEBUG_XKPPLACEMENT
qDebug() << "calculateSize()";
#endif
QSize totalSize;
for(int i = 0; i < list.size(); ++i) {
ItemWrapper *wrapper = list.at(i);
Placement position = wrapper->position;
QSize itemSize;
if(sizeType == MinimumSize)
itemSize = wrapper->item->minimumSize();
else if(sizeType == SizeHint)
itemSize = wrapper->item->sizeHint();
else if(sizeType == PlacementSize && wrapper->widget) {
if(wrapper->widget->property(placementSizeName).toSize() == QSize(-1, -1)) {
wrapper->widget->setProperty(placementSizeName, wrapper->widget->size());
itemSize = wrapper->widget->size();
} else {
itemSize = wrapper->widget->property(placementSizeName).toSize();
}
}
if(position == Top || position == Bottom || position == Center)
totalSize.rheight() += itemSize.height();
if(position == Left || position == Right || position == Center)
totalSize.rwidth() += itemSize.width();
}
return totalSize;
}
示例14: sizeHint
QSize MainWindow::sizeHint() const
{
QSize size = printer->paperSize(QPrinter::Point).toSize() * 1.2;
size.rwidth() += brushWidget->sizeHint().width();
return size.boundedTo(
QApplication::desktop()->availableGeometry().size());
}
示例15: calculateSize
QSize BorderLayout::calculateSize(SizeType sizeType) const
{
QSize totalSize;
for (int i = 0; i < list.size(); ++i) {
ItemWrapper *wrapper = list.at(i);
Position position = wrapper->position;
QSize itemSize;
if (sizeType == MinimumSize)
itemSize = wrapper->item->minimumSize();
else // (sizeType == SizeHint)
itemSize = wrapper->item->sizeHint();
if (position == North || position == South || position == Center)
totalSize.rheight() += itemSize.height();
if (position == West || position == East || position == Center)
totalSize.rwidth() += itemSize.width();
}
if (totalSize.height() < 0)
totalSize.setHeight(0);
if (totalSize.width() < 0)
totalSize.setWidth(0);
return totalSize;
}