/*! Resizes the top-level widget containing this widget. The event is in \a e. */ void QSizeGrip::mouseMoveEvent( QMouseEvent * e ) { if ( e->state() != LeftButton ) return; QWidget* tlw = qt_sizegrip_topLevelWidget(this); if ( tlw->testWState(WState_ConfigPending) ) return; QPoint np( e->globalPos() ); QWidget* ws = qt_sizegrip_workspace( this ); if ( ws ) { QPoint tmp( ws->mapFromGlobal( np ) ); if ( tmp.x() > ws->width() ) tmp.setX( ws->width() ); if ( tmp.y() > ws->height() ) tmp.setY( ws->height() ); np = ws->mapToGlobal( tmp ); } int w; int h = np.y() - p.y() + s.height(); if ( QApplication::reverseLayout() ) w = s.width() - ( np.x() - p.x() ); else w = np.x() - p.x() + s.width(); if ( w < 1 ) w = 1; if ( h < 1 ) h = 1; QSize ms( tlw->minimumSizeHint() ); ms = ms.expandedTo( minimumSize() ); if ( w < ms.width() ) w = ms.width(); if ( h < ms.height() ) h = ms.height(); if (QApplication::reverseLayout()) { tlw->resize( w, h ); if (tlw->size() == QSize(w,h)) tlw->move( tlw->x() + ( np.x()-p.x() ), tlw->y() ); } else { tlw->resize( w, h ); } #ifdef Q_WS_WIN MSG msg; while( PeekMessage( &msg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE ) ) ; #endif QApplication::syncX(); if ( QApplication::reverseLayout() && tlw->size() == QSize(w,h) ) { s.rwidth() = tlw->size().width(); p.rx() = np.x(); } }
void WTextSourceViewerLine::setSizes() { QFontMetrics fm(displayFont); char_space=fm.ascent(); bool has_comment = ! commented_lines.isEmpty(); int c_space=static_cast<int>(char_space)+1; int c_digit=static_cast<int>(fm.width('M'))+1; QSize sz(0,minimumSize().height()); int n_space=2; if (has_comment) n_space++; int n_digit=1; if (number_of_lines>0) { int l=number_of_lines; while (l>0) { n_digit++; l=l/10; } } sz.setWidth(c_digit*n_digit+c_space*n_space); if (minimumSize().width()!=sz.width()) setMinimumSize(QSize(sz.width(),minimumSize().height())); if (maximumSize().width()!=sz.width()) setMaximumSize(QSize(sz.width(),maximumSize().height())); }
void Widget::show(const Point &point) { const iint32 x = point.x(); const iint32 y = point.y(); const iint32 width = minimumSize().width(); const iint32 height = minimumSize().height(); IdealGUI::Application *app = static_cast<IdealGUI::Application*>(application()); IdealGUI::Application::PrivateImpl *a_d = static_cast<IdealGUI::Application::PrivateImpl*>(app->d); Display *dpy = a_d->m_dpy; if (!D_I->m_window) { if (!d->m_parentWidget) { D_I->m_window = XCreateSimpleWindow(dpy, XDefaultRootWindow(dpy), x, y, width, height, 0, XWhitePixel(dpy, XDefaultScreen(dpy)), XWhitePixel(dpy, XDefaultScreen(dpy))); } else { D_I->m_window = XCreateSimpleWindow(dpy, static_cast<IdealGUI::Widget::PrivateImpl*>(d->m_parentWidget->d)->m_window, x, y, width, height, 0, XWhitePixel(dpy, XDefaultScreen(dpy)), XWhitePixel(dpy, XDefaultScreen(dpy))); } a_d->m_widgetMap[D_I->m_window] = this; XSelectInput(dpy, D_I->m_window, ExposureMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | FocusChangeMask | KeyPressMask | KeyReleaseMask | StructureNotifyMask | SubstructureNotifyMask); } XMapWindow(dpy, D_I->m_window); D_I->m_cs = cairo_xlib_surface_create(dpy, D_I->m_window, DefaultVisual(dpy, 0), width, height); }
bool CNItem::preResize( QRect sizeRect ) { if ( (std::abs(sizeRect.width()) < minimumSize().width()) || (std::abs(sizeRect.height()) < minimumSize().height()) ) return false; updateConnectorPoints(false); return true; }
void UISettingsDialog::showEvent(QShowEvent *pEvent) { /* Base-class processing: */ QIMainDialog::showEvent(pEvent); /* One may think that QWidget::polish() is the right place to do things * below, but apparently, by the time when QWidget::polish() is called, * the widget style & layout are not fully done, at least the minimum * size hint is not properly calculated. Since this is sometimes necessary, * we provide our own "polish" implementation. */ if (m_fPolished) return; m_fPolished = true; int iMinWidth = m_pSelector->minWidth(); #ifdef Q_WS_MAC /* Remove all title bar buttons (Buggy Qt): */ ::darwinSetHidesAllTitleButtons(this); /* Set all size policies to ignored: */ for (int i = 0; i < m_pStack->count(); ++i) m_pStack->widget(i)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored); /* Activate every single page to get the optimal size: */ for (int i = m_pStack->count() - 1; i >= 0; --i) { m_pStack->widget(i)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); /* Prevent this widgets to go in the Small/Mini size state which is * available on Mac OS X. Not sure why this happens but this seems to help * against. */ QList <QWidget*> list = m_pStack->widget(i)->findChildren<QWidget*>(); for (int a = 0; a < list.size(); ++a) { QWidget *w = list.at(a); if (w->parent() == m_pStack->widget(i)) w->setFixedHeight(w->sizeHint().height()); } m_pStack->setCurrentIndex(i); /* Now make sure the layout is freshly calculated. */ layout()->activate(); QSize s = minimumSize(); if (iMinWidth > s.width()) s.setWidth(iMinWidth); m_sizeList.insert(0, s); m_pStack->widget(i)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored); } sltCategoryChanged(m_pSelector->currentId()); #else /* Q_WS_MAC */ /* Resize to the minimum possible size: */ QSize s = minimumSize(); if (iMinWidth > s.width()) s.setWidth(iMinWidth); resize(s); #endif /* Q_WS_MAC */ }
int PandemicWindow::hoveredEdges(QMouseEvent *event) { if(minimumSize() == maximumSize()) return NoEdge; int edges = NoEdge; //left edge if(minimumWidth() != maximumWidth() && event->localPos().x() >= 0 && event->localPos().x() <= 8 && event->localPos().y() > 0 && event->localPos().y() <= height()) { edges |= LeftEdge; } //bottom edge if(minimumHeight() != maximumHeight() && event->localPos().x() > 0 && event->localPos().x() < width() && event->localPos().y() > height() - 8 && event->localPos().y() <= height()) { edges |= BottomEdge; } //right edge if(minimumWidth() != maximumWidth() && event->localPos().x() >= width() - 8 && event->localPos().x() <= width() && event->localPos().y() > 0 && event->localPos().y() <= height()) { edges |= RightEdge; } //top edge if(minimumHeight() != maximumHeight() && event->localPos().x() > 0 && event->localPos().x() < width() && event->localPos().y() >= 0 && event->localPos().y() <= 8) { edges |= TopEdge; } return edges; }
PandemicWindow::PandemicWindow(PandemicModuleBase *module, QWidget *widget) : QMdiSubWindow(), _module(module), _package(module->generateWindowPackage()) { setObjectName("PandemicWindow"); setWindowFlags(windowFlags() | Qt::FramelessWindowHint); _cursor = cursor(); _resizePoint = NoEdge; _resizing = false; _titleBar = new SubWindowTitleBar(this); _centralWidget = new QWidget(); _centralLayout = new QGridLayout(); _centralWidget->setLayout(_centralLayout); _centralLayout->setSpacing(0); _centralLayout->setContentsMargins(0, 1, 0, 0); _centralWidget->setObjectName("PandemicWindowContent"); _centralLayout->addWidget(_titleBar, 0, 0, 1, 1); _centralLayout->addWidget(widget, 1, 0, 1, 1); layout()->setContentsMargins(8, 0, 8, 8); setWidget(_centralWidget); setMinimumSize(QSize(widget->sizeHint().width(), widget->sizeHint().height())); resize(minimumSize()); connect(this, SIGNAL(windowStateChanged(Qt::WindowStates,Qt::WindowStates)), this, SLOT(stateChanged(Qt::WindowStates,Qt::WindowStates))); }
bool sufficientSize(uint32_t size) { if (size < minimumSize()) return false; else return true; }
void Overview::load(const QImage& image, qreal pixelratio) { // Find minimum scale m_min_scale_level = 9; int side_max = std::max(image.width(), image.height()) * 0.9; int side = 400; if (side_max > side) { for (int i = 9; i >= 0; --i) { int side_test = std::floor(400.0 / ZoomSlider::scaleFactor(i)); if (side_test > side_max) { break; } m_min_scale_level = i; side = side_test; } } else { side = side_max; } QPixmap pixmap = QPixmap::fromImage(image.scaled(side * pixelratio, side * pixelratio, Qt::KeepAspectRatio, Qt::SmoothTransformation), Qt::AutoColor | Qt::AvoidDither); pixmap.setDevicePixelRatio(pixelratio); zoom(m_min_scale_level); // Resize window bool default_size = m_default; QSize size = transform().mapRect(QRect(QPoint(0,0), pixmap.size() / pixelratio)).size(); setMinimumSize(size); if (default_size) { resize(minimumSize()); } // Show overview setPixmap(pixmap); }
void DockWidget::closeEvent(QCloseEvent *event) { setFloating(true); setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, minimumSize(), qApp->desktop()->availableGeometry())); emit closed(); event->accept(); QDockWidget::closeEvent(event); }
KisColorSelectorSettings::KisColorSelectorSettings(QWidget *parent) : KisPreferenceSet(parent), ui(new Ui::KisColorSelectorSettings) { ui->setupUi(this); ui->lbl_lastUsedNumRows->hide(); ui->lastUsedColorsNumRows->hide(); ui->lbl_commonColorsNumCols->hide(); ui->commonColorsNumCols->hide(); resize(minimumSize()); ui->colorSelectorConfiguration->setColorSpace(ui->colorSpace->currentColorSpace()); connect(ui->colorSpace, SIGNAL(colorSpaceChanged(const KoColorSpace*)), ui->colorSelectorConfiguration, SLOT(setColorSpace(const KoColorSpace*))); connect(ui->minimalShadeSelectorLineCount, SIGNAL(valueChanged(int)), ui->minimalShadeSelectorLineSettings, SLOT(setLineCount(int))); connect(ui->minimalShadeSelectorLineSettings, SIGNAL(lineCountChanged(int)), ui->minimalShadeSelectorLineCount, SLOT(setValue(int))); connect(ui->minimalShadeSelectorAsGradient, SIGNAL(toggled(bool)), ui->minimalShadeSelectorLineSettings, SIGNAL(setGradient(bool))); connect(ui->minimalShadeSelectorAsColorPatches, SIGNAL(toggled(bool)), ui->minimalShadeSelectorLineSettings, SIGNAL(setPatches(bool))); connect(ui->minimalShadeSelectorLineHeight, SIGNAL(valueChanged(int)), ui->minimalShadeSelectorLineSettings, SIGNAL(setLineHeight(int))); connect(ui->minimalShadeSelectorPatchesPerLine, SIGNAL(valueChanged(int)), ui->minimalShadeSelectorLineSettings, SIGNAL(setPatchCount(int))); }
QSize MirrorAddDlg::sizeHint() const { QSize sh = KDialog::sizeHint(); sh.setHeight(minimumSize().height()); sh.setWidth(sh.width() * 1.5); return sh; }
/** * Calculates and sets the size of the widget for a creation message. */ void MessageWidget::calculateDimensionsCreation() { int x = 0; int x1 = m_pOw[Uml::RoleType::A]->centerX(); int x2 = m_pOw[Uml::RoleType::B]->x(); int w2 = m_pOw[Uml::RoleType::B]->width(); if (x1 > x2) x2 += w2; int widgetWidth = 0; if (x1 < x2) { x = x1; widgetWidth = x2 - x1; } else { x = x2; widgetWidth = x1 - x2; } x += 1; widgetWidth -= 2; int widgetHeight = minimumSize().height(); setPos(x, m_pOw[Uml::RoleType::B]->y() + m_pOw[Uml::RoleType::B]->height() / 2); setSize(widgetWidth, widgetHeight); }
/** * Calculates and sets the size of the widget for an asynchronous message. */ void MessageWidget::calculateDimensionsAsynchronous() { int x = 0; int x1 = m_pOw[Uml::RoleType::A]->centerX(); int x2 = m_pOw[Uml::RoleType::B]->centerX(); int widgetWidth = 0; if(isSelf()) { widgetWidth = 50; x = x1; } else if(x1 < x2) { x = x1; widgetWidth = x2 - x1; } else { x = x2; widgetWidth = x1 - x2; } x += 1; widgetWidth -= 2; QSizeF minSize = minimumSize(); int widgetHeight = 0; if (height() < minSize.height()) { widgetHeight = minSize.height(); } else { widgetHeight = height(); } setX(x); setSize(widgetWidth, widgetHeight); }
Palapeli::PieceHolder::PieceHolder(QWidget* parent, const QSizeF& pieceArea, const QString& title) : m_scene(scene()) { qDebug() << "CONSTRUCTING Palapeli::PieceHolder" << title; setParent(parent); setWindowFlags(Qt::Window | Qt::Tool | Qt::WindowTitleHint); // Allow space for (2 * 2) pieces in minimum view initially. m_scene->setPieceAreaSize(pieceArea); m_scene->initializeGrid(QPointF(0.0, 0.0)); m_scene->setMinGrid(minGrid); // Add margin for constraint_handles+spacer and setSceneRect(). QRectF rect = m_scene->piecesBoundingRect(); qreal handleWidth = qMin(rect.width(), rect.height())/25.0; m_scene->addMargin(handleWidth, 0.5*handleWidth); setWindowTitle(title); qreal s = calculateCloseUpScale(); QRectF r = m_scene->sceneRect(); setMinimumSize(s*r.width()+1.0, s*r.height()+1.0); resize(minimumSize()); qDebug() << "Close-up scale" << s << "pieceArea" << pieceArea << "size" << size(); QTransform t; t.scale(s, s); setTransform(t); centerOn(r.center()); setSelected(true); show(); }
int QColorTabWidget::addTab( const QString& strCaption, QWidget* pChildWidget, QColor clrTab/*=QColor(255,60,60,200)*/, QImage* pIconImage/*=NULL*/) { pIconImage = pIconImage; // TODO: icon TabInfo ti; ti.pChildWidget = pChildWidget; ti.strCaption = strCaption; ti.pIconImage = NULL; ti.clrTab = clrTab; m_aryTabInfo.push_back(ti); if (pChildWidget) { QSize sizeChild = pChildWidget->minimumSize(); sizeChild.setWidth( sizeChild.width() + (!isHorzTab() ? m_sizeTabHeader.width() : 0) + 4 + 1 + 2 ); sizeChild.setHeight( sizeChild.height() + (isHorzTab() ? m_sizeTabHeader.height() : 0) + 4 + 1 + 2 ); QSize sizeParent = minimumSize(); QSize sizeNewMinimum; sizeNewMinimum.setWidth( sizeParent.width() < sizeChild.width() ? sizeChild.width() : sizeParent.width() ); sizeNewMinimum.setHeight( sizeParent.height() < sizeChild.height() ? sizeChild.height() : sizeParent.height() ); setMinimumSize( sizeNewMinimum ); } return m_aryTabInfo.size(); }
LayoutSize CachedImage::imageSizeForRenderer(const RenderObject* renderer, float multiplier, SizeType sizeType) { if (!m_image) return LayoutSize(); LayoutSize imageSize(m_image->size()); #if ENABLE(CSS_IMAGE_ORIENTATION) if (renderer && is<BitmapImage>(*m_image)) { ImageOrientationDescription orientationDescription(renderer->shouldRespectImageOrientation(), renderer->style().imageOrientation()); if (orientationDescription.respectImageOrientation() == RespectImageOrientation) imageSize = LayoutSize(downcast<BitmapImage>(*m_image).sizeRespectingOrientation(orientationDescription)); } #else if (is<BitmapImage>(*m_image) && (renderer && renderer->shouldRespectImageOrientation() == RespectImageOrientation)) imageSize = LayoutSize(downcast<BitmapImage>(*m_image).sizeRespectingOrientation()); #endif // ENABLE(CSS_IMAGE_ORIENTATION) else if (is<SVGImage>(*m_image) && sizeType == UsedSize) { imageSize = LayoutSize(m_svgImageCache->imageSizeForRenderer(renderer)); } if (multiplier == 1.0f) return imageSize; // Don't let images that have a width/height >= 1 shrink below 1 when zoomed. float widthScale = m_image->hasRelativeWidth() ? 1.0f : multiplier; float heightScale = m_image->hasRelativeHeight() ? 1.0f : multiplier; LayoutSize minimumSize(imageSize.width() > 0 ? 1 : 0, imageSize.height() > 0 ? 1 : 0); imageSize.scale(widthScale, heightScale); imageSize.clampToMinimumSize(minimumSize); ASSERT(multiplier != 1.0f || (imageSize.width().fraction() == 0.0f && imageSize.height().fraction() == 0.0f)); return imageSize; }
Parameter& size(int size_value) { minimumSize(size_value); maximumSize(size_value); return *this; }
PreferencesDialog::PreferencesDialog(QWidget *parent, PreferencesModel *preferences, const SysinfoModel *sysinfo) : QDialog(parent), m_sysinfo(sysinfo), ui(new Ui::PreferencesDialog()) { ui->setupUi(this); setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); setFixedSize(minimumSize()); MUtils::GUI::enable_close_button(this, false); ui->comboBoxPriority->setItemData(0, QVariant::fromValue( 1)); //Above Normal ui->comboBoxPriority->setItemData(1, QVariant::fromValue( 0)); //Normal ui->comboBoxPriority->setItemData(2, QVariant::fromValue(-1)); //Below Normal ui->comboBoxPriority->setItemData(3, QVariant::fromValue(-2)); //Idle ui->labelRunNextJob ->installEventFilter(this); ui->labelUse64BitAvs2YUV ->installEventFilter(this); ui->labelSaveLogFiles ->installEventFilter(this); ui->labelSaveToSourceFolder->installEventFilter(this); ui->labelEnableSounds ->installEventFilter(this); ui->labelDisableWarnings ->installEventFilter(this); ui->labelNoUpdateReminder ->installEventFilter(this); ui->labelSaveQueueNoConfirm->installEventFilter(this); ui->checkBoxDummy1->installEventFilter(this); ui->checkBoxDummy2->installEventFilter(this); connect(ui->resetButton, SIGNAL(clicked()), this, SLOT(resetButtonPressed())); connect(ui->checkDisableWarnings, SIGNAL(toggled(bool)), this, SLOT(disableWarningsToggled(bool))); m_preferences = preferences; }
UIMachineSettingsUSBFilterDetails::UIMachineSettingsUSBFilterDetails(UISettingsPageType type, QWidget *pParent /* = 0 */) : QIWithRetranslateUI2<QIDialog>(pParent, Qt::Sheet) , m_type(type) { /* Apply UI decorations */ Ui::UIMachineSettingsUSBFilterDetails::setupUi (this); mCbRemote->insertItem (UIMachineSettingsUSB::ModeAny, ""); /* Any */ mCbRemote->insertItem (UIMachineSettingsUSB::ModeOn, ""); /* Yes */ mCbRemote->insertItem (UIMachineSettingsUSB::ModeOff, ""); /* No */ mLbRemote->setHidden (m_type != UISettingsPageType_Machine); mCbRemote->setHidden (m_type != UISettingsPageType_Machine); mCbAction->insertItem (0, ""); /* KUSBDeviceFilterAction_Ignore */ mCbAction->insertItem (1, ""); /* KUSBDeviceFilterAction_Hold */ mLbAction->setHidden (m_type != UISettingsPageType_Global); mCbAction->setHidden (m_type != UISettingsPageType_Global); mLeName->setValidator (new QRegExpValidator (QRegExp (".+"), this)); mLeVendorID->setValidator (new QRegExpValidator (QRegExp ("[0-9a-fA-F]{0,4}"), this)); mLeProductID->setValidator (new QRegExpValidator (QRegExp ("[0-9a-fA-F]{0,4}"), this)); mLeRevision->setValidator (new QRegExpValidator (QRegExp ("[0-9]{0,4}"), this)); mLePort->setValidator (new QRegExpValidator (QRegExp ("[0-9]*"), this)); /* Applying language settings */ retranslateUi(); resize (minimumSize()); setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed); }
void QTFAbstractPanel::toggleHide() { m_isHidden = !m_isHidden; if(m_isHidden) { m_showButton->setIcon(m_checked); m_origHeight = height(); m_origMinimumHeight = minimumHeight(); if(m_widgets && !m_widgets->empty()) { for(int i = 0; i < m_widgets->size();i++) { m_origHeight += (*m_widgets)[i]->height(); m_origMinimumHeight += (*m_widgets)[i]->minimumHeight(); (*m_widgets)[i]->hide(); } } minSize = minimumSize(); maxSize = maximumSize(); //m_pTFEditor->setMinimumHeight(0); setFixedHeight(20); m_pTFEditor->setMinimumHeight(m_pTFEditor->minimumHeight() - (m_origMinimumHeight - 20)); m_pTFEditor->resize(m_pTFEditor->width(), m_pTFEditor->height() + 20 - m_origHeight); } else { m_showButton->setIcon(m_unchecked); if(m_widgets && !m_widgets->empty()) { for(int i = 0; i < m_widgets->size(); i++) { (*m_widgets)[i]->show(); } } setMinimumSize(minSize); setMaximumSize(maxSize); m_pTFEditor->resize(m_pTFEditor->width(), m_pTFEditor->height() + m_origHeight - 20); m_pTFEditor->setMinimumHeight(m_pTFEditor->minimumHeight() + (m_origMinimumHeight - 20)); //m_pTFEditor->setMinimumHeight(m_pTFEditor->minimumHeight() + (m_origHeight - 20)); } repaint(); }
void QToolBarAreaLayoutLine::fitLayout() { int last = -1; int min = pick(o, minimumSize()); int space = pick(o, rect.size()); int extra = qMax(0, space - min); for (int i = 0; i < toolBarItems.count(); ++i) { QToolBarAreaLayoutItem &item = toolBarItems[i]; if (item.skip()) continue; int itemMin = pick(o, item.minimumSize()); int itemHint = pick(o, item.sizeHint()); int itemExtra = qMin(itemHint - itemMin, extra); item.size = itemMin + itemExtra; extra -= itemExtra; last = i; } // calculate the positions from the sizes int pos = 0; for (int i = 0; i < toolBarItems.count(); ++i) { QToolBarAreaLayoutItem &item = toolBarItems[i]; if (item.skip()) continue; item.pos = pos; if (i == last) // stretch the last item to the end of the line item.size = qMax(0, pick(o, rect.size()) - item.pos); pos += item.size; } }
LayoutSize CachedImage::imageSizeForRenderer(const RenderElement* renderer, float multiplier, SizeType sizeType) { if (!m_image) return LayoutSize(); LayoutSize imageSize; if (is<BitmapImage>(*m_image) && renderer && renderer->shouldRespectImageOrientation() == RespectImageOrientation) imageSize = LayoutSize(downcast<BitmapImage>(*m_image).sizeRespectingOrientation()); else if (is<SVGImage>(*m_image) && sizeType == UsedSize) imageSize = LayoutSize(m_svgImageCache->imageSizeForRenderer(renderer)); else imageSize = LayoutSize(m_image->size()); if (multiplier == 1.0f) return imageSize; // Don't let images that have a width/height >= 1 shrink below 1 when zoomed. float widthScale = m_image->hasRelativeWidth() ? 1.0f : multiplier; float heightScale = m_image->hasRelativeHeight() ? 1.0f : multiplier; LayoutSize minimumSize(imageSize.width() > 0 ? 1 : 0, imageSize.height() > 0 ? 1 : 0); imageSize.scale(widthScale, heightScale); imageSize.clampToMinimumSize(minimumSize); ASSERT(multiplier != 1.0f || (imageSize.width().fraction() == 0.0f && imageSize.height().fraction() == 0.0f)); return imageSize; }
MatrixFunctionDialog::MatrixFunctionDialog(Matrix* m, QWidget* parent, Qt::WFlags fl) : KDialog(parent, fl), m_matrix(m) { Q_ASSERT(m_matrix); setWindowTitle(i18n("Function values")); QFrame* mainWidget = new QFrame(this); ui.setupUi(mainWidget); setMainWidget( mainWidget ); ui.tbConstants->setIcon( KIcon("labplot-format-text-symbol") ); ui.tbFunctions->setIcon( KIcon("preferences-desktop-font") ); QStringList vars; vars<<"x"<<"y"; ui.teEquation->setVariables(vars); ui.teEquation->setFocus(); QString info = "[" + QString::number(m_matrix->xStart()) + ", " + QString::number(m_matrix->xEnd()) + "], " + QString::number(m_matrix->columnCount()) + " " + i18n("values"); ui.lXInfo->setText(info); info = "[" + QString::number(m_matrix->yStart()) + ", " + QString::number(m_matrix->yEnd()) + "], " + QString::number(m_matrix->rowCount()) + " " + i18n("values"); ui.lYInfo->setText(info); ui.teEquation->setPlainText(m_matrix->formula()); setButtons( KDialog::Ok | KDialog::Cancel ); setButtonText(KDialog::Ok, i18n("&Generate")); setButtonToolTip(KDialog::Ok, i18n("Generate function values")); connect( ui.teEquation, SIGNAL(expressionChanged()), this, SLOT(checkValues()) ); connect( ui.tbConstants, SIGNAL(clicked()), this, SLOT(showConstants()) ); connect( ui.tbFunctions, SIGNAL(clicked()), this, SLOT(showFunctions()) ); connect(this, SIGNAL(okClicked()), this, SLOT(generate())); resize( QSize(300,0).expandedTo(minimumSize()) ); }
/* * Constructs a lotSerialRegistration as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * */ lotSerialRegistration::lotSerialRegistration(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : XDialog(parent, name, modal, fl) { setupUi(this); _lsregid = -1; // signals and slots connections connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); connect(_soldDate, SIGNAL(newDate(const QDate&)), this, SLOT(sDateUpdated())); connect(_crmacct, SIGNAL(newId(int)), this, SLOT(sSetSoCustId())); connect(_so, SIGNAL(newId(int)), this, SLOT(sSetSoId())); connect(_deleteChar, SIGNAL(clicked()), this, SLOT(sDeleteCharass())); connect(_editChar, SIGNAL(clicked()), this, SLOT(sEditCharass())); connect(_newChar, SIGNAL(clicked()), this, SLOT(sNewCharass())); _charass->addColumn(tr("Characteristic"), _itemColumn, Qt::AlignLeft ); _charass->addColumn(tr("Value"), -1, Qt::AlignLeft ); _lotSerial->setStrict(true); _cntct->setAccountVisible(FALSE); _cntct->setActiveVisible(FALSE); _so->setType(cSoReleased); _qty->setValidator(omfgThis->qtyVal()); resize(minimumSize()); }
void ActionDialog::updateMinimalGeometry() { int w = width(); resize(minimumSize()); adjustSize(); resize(w, height()); }
LayoutSize ImageResource::imageSizeForLayoutObject(const LayoutObject* layoutObject, float multiplier, SizeType sizeType) { ASSERT(!isPurgeable()); if (!m_image) return LayoutSize(); LayoutSize imageSize; if (m_image->isBitmapImage() && (layoutObject && layoutObject->shouldRespectImageOrientation() == RespectImageOrientation)) imageSize = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrientation()); else if (m_image->isSVGImage() && sizeType == NormalSize) imageSize = LayoutSize(svgImageSizeForLayoutObject(layoutObject)); else imageSize = LayoutSize(m_image->size()); if (multiplier == 1.0f) return imageSize; // Don't let images that have a width/height >= 1 shrink below 1 when zoomed. float widthScale = m_image->hasRelativeWidth() ? 1.0f : multiplier; float heightScale = m_image->hasRelativeHeight() ? 1.0f : multiplier; LayoutSize minimumSize(imageSize.width() > 0 ? 1 : 0, imageSize.height() > 0 ? 1 : 0); imageSize.scale(widthScale, heightScale); imageSize.clampToMinimumSize(minimumSize); ASSERT(multiplier != 1.0f || (imageSize.width().fraction() == 0.0f && imageSize.height().fraction() == 0.0f)); return imageSize; }
QSize QBoxLayout_QtDShell::__override_minimumSize(bool static_call) const { if (static_call) { return QBoxLayout::minimumSize(); } else { return minimumSize(); } }
void Overview::resizeEvent(QResizeEvent* event) { m_default = (size() == minimumSize()); QSettings settings; settings.setValue("Overview/Default", m_default); settings.setValue("Overview/Geometry", saveGeometry()); QGraphicsView::resizeEvent(event); }
QSize QWidgetItem_QtDShell::__override_minimumSize(bool static_call) const { if (static_call) { return QWidgetItem::minimumSize(); } else { return minimumSize(); } }