void PackagesDelegate::handleRowChanged (const QModelIndex& current, const QModelIndex& previous) { CurrentSelection_ = current; emit sizeHintChanged (previous); emit sizeHintChanged (current); }
void LineEdit::init() { m_leftWidget = new SideWidget(this); m_leftWidget->resize(0, 0); m_leftLayout = new QHBoxLayout(m_leftWidget); m_leftLayout->setContentsMargins(0, 0, 0, 0); if (isRightToLeft()) m_leftLayout->setDirection(QBoxLayout::RightToLeft); else m_leftLayout->setDirection(QBoxLayout::LeftToRight); m_leftLayout->setSizeConstraint(QLayout::SetFixedSize); m_rightWidget = new SideWidget(this); m_rightWidget->resize(0, 0); m_rightLayout = new QHBoxLayout(m_rightWidget); if (isRightToLeft()) m_rightLayout->setDirection(QBoxLayout::RightToLeft); else m_rightLayout->setDirection(QBoxLayout::LeftToRight); m_rightLayout->setContentsMargins(0, 0, 0, 0); QSpacerItem *horizontalSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); m_rightLayout->addItem(horizontalSpacer); setWidgetSpacing(3); connect(m_leftWidget, SIGNAL(sizeHintChanged()), this, SLOT(updateTextMargins())); connect(m_rightWidget, SIGNAL(sizeHintChanged()), this, SLOT(updateTextMargins())); }
void PackagesDelegate::handleRowChanged (const QModelIndex& current, const QModelIndex& previous) { CurrentSelection_ = current; if (SelectableBrowser_) SelectableBrowser_->hide (); emit sizeHintChanged (previous); emit sizeHintChanged (current); }
RemoteAccessWidget::RemoteAccessWidget( const ComputerControlInterface& computerControlInterface, bool viewOnly ) : QWidget( nullptr ), m_computerControlInterface( computerControlInterface ), m_vncView( new VncView( computerControlInterface.computer().hostAddress(), -1, this, VncView::RemoteControlMode ) ), m_coreConnection( new VeyonCoreConnection( m_vncView->vncConnection() ) ), m_toolBar( new RemoteAccessWidgetToolBar( this, viewOnly ) ) { setWindowTitle( tr( "%1 Remote Access" ).arg( VeyonCore::applicationName() ) ); setWindowIcon( QPixmap( ":/remoteaccess/kmag.png" ) ); setAttribute( Qt::WA_DeleteOnClose, true ); m_vncView->move( 0, 0 ); connect( m_vncView, SIGNAL( mouseAtTop() ), m_toolBar, SLOT( appear() ) ); connect( m_vncView, SIGNAL( keyEvent( int, bool ) ), this, SLOT( checkKeyEvent( int, bool ) ) ); connect( m_vncView, SIGNAL( sizeHintChanged() ), this, SLOT( updateSize() ) ); showMaximized(); LocalSystem::activateWindow( this ); showNormal(); toggleViewOnly( viewOnly ); }
void Context::Applet::collapseAnimationFinished() { emit sizeHintChanged( Qt::PreferredSize ); updateConstraints(); update(); }
DelegateConfigWrapper::DelegateConfigWrapper( QWidget* conf, const QString& title, QWidget* parent, Qt::WindowFlags flags ) : QDialog( parent, flags ) , m_widget( conf ) , m_deleted( false ) { m_widget->setWindowFlags( Qt::Sheet ); #ifdef Q_WS_MAC m_widget->setVisible( true ); #endif setWindowTitle( title ); QVBoxLayout* v = new QVBoxLayout( this ); v->setContentsMargins( 0, 0, 0, 0 ); v->addWidget( m_widget ); m_buttons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this ); m_okButton = m_buttons->button( QDialogButtonBox::Ok ); connect( m_buttons, SIGNAL( clicked( QAbstractButton*) ), this, SLOT( closed( QAbstractButton* ) ) ); connect( this, SIGNAL( rejected() ), this, SLOT( rejected() ) ); v->addWidget( m_buttons ); setLayout( v ); #ifdef Q_WS_MAC setSizeGripEnabled( false ); setMinimumSize( sizeHint() ); setMaximumSize( sizeHint() ); // to remove the resize grip on osx this is the only way if( conf->metaObject()->indexOfSignal( "sizeHintChanged()" ) > -1 ) connect( conf, SIGNAL( sizeHintChanged() ), this, SLOT( updateSizeHint() ) ); #else m_widget->setVisible( true ); #endif }
void TwitterConfigWidget::authenticateVerifyReply( const QTweetUser &user ) { qDebug() << Q_FUNC_INFO; if ( user.id() == 0 ) { QMessageBox::critical( this, tr("Tweetin' Error"), tr("The credentials could not be verified.\nYou may wish to try re-authenticating.") ); emit twitterAuthed( false ); return; } m_plugin->setTwitterScreenName( user.screenName() ); m_plugin->setTwitterCachedFriendsSinceId( 0 ); m_plugin->setTwitterCachedMentionsSinceId( 0 ); ui->twitterStatusLabel->setText( tr( "Status: Credentials saved for %1" ).arg( m_plugin->twitterScreenName() ) ); ui->twitterAuthenticateButton->setText( tr( "De-authenticate" ) ); ui->twitterSyncGroupBox->setVisible( true ); ui->twitterTweetComboBox->setCurrentIndex( 0 ); ui->twitterUserTweetLineEdit->setVisible( false ); ui->twitterTweetGotTomahawkButton->setText( tr( "Tweet!" ) ); m_plugin->connectPlugin( false ); emit twitterAuthed( true ); emit sizeHintChanged(); }
void DateTimeGroup::updateSize() { Plasma::FormFactor f = formFactor(); if (f != Plasma::Vertical && f != Plasma::Horizontal) { const QFontMetricsF metrics(KGlobalSettings::smallestReadableFont()); setMinimumSize(metrics.size(Qt::TextSingleLine, dtg)); } int aspect = 12; int w, h; w = (int)(contentsRect().height() * aspect); h = (int)(contentsRect().width() / aspect); if (f == Plasma::Horizontal) { setMinimumSize(QSize(w, 0)); } else { setMinimumSize(QSize(0, h)); } setPreferredSize(QSize(w, h)); emit sizeHintChanged(Qt::PreferredSize); if (m_isDefaultFont) { expandFontToMax(m_plainDateTimeGroupFont, dtg); } generatePixmap(); }
DelegateConfigWrapper::DelegateConfigWrapper( Tomahawk::Accounts::Account* account, QWidget* parent, Qt::WindowFlags flags ) : QDialog( parent, flags ) , m_account( account ) , m_widget( account->configurationWidget() ) , m_aboutW( account->aboutWidget() ) , m_buttons( nullptr ) , m_okButton( nullptr ) , m_deleteButton( nullptr ) , m_errorLabel( new QLabel( this ) ) , m_deleted( false ) { setWindowTitle( tr("%1 Config", "Window title for account config windows" ).arg( account->accountFriendlyName() ) ); QVBoxLayout* v = new QVBoxLayout( this ); v->setContentsMargins( 0, 0, 0, 0 ); v->addWidget( m_widget ); v->addStretch(); QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Ok | QDialogButtonBox::Cancel; if ( m_aboutW ) { m_aboutW->hide(); buttons |= QDialogButtonBox::Help; } m_buttons = new QDialogButtonBox( buttons, Qt::Horizontal, this ); m_okButton = m_buttons->button( QDialogButtonBox::Ok ); connect( m_buttons, SIGNAL( clicked( QAbstractButton*) ), this, SLOT( closed( QAbstractButton* ) ) ); connect( this, SIGNAL( rejected() ), this, SLOT( rejected() ) ); if ( m_aboutW ) { connect( m_buttons->button( QDialogButtonBox::Help ), SIGNAL( clicked( bool ) ), this, SLOT( aboutClicked( bool ) ) ); m_buttons->button( QDialogButtonBox::Help )->setText( tr( "About" ) ); } QHBoxLayout* h = new QHBoxLayout( this ); h->addWidget( m_buttons ); if ( m_widget && m_widget->layout() ) h->setContentsMargins( m_widget->layout()->contentsMargins() ); else if ( m_widget ) h->setContentsMargins( m_widget->contentsMargins() ); m_errorLabel->setAlignment( Qt::AlignCenter ); m_errorLabel->setWordWrap( true ); v->addWidget( m_errorLabel ); v->addLayout( h ); setLayout( v ); m_widget->setVisible( true ); setSizeGripEnabled( false ); updateSizeHint(); if ( m_widget->metaObject()->indexOfSignal( "sizeHintChanged()" ) > -1 ) connect( m_widget, SIGNAL( sizeHintChanged() ), this, SLOT( updateSizeHint() ) ); connect( m_account, SIGNAL( configTestResult( Tomahawk::Accounts::ConfigTestResultType ) ), SLOT( onConfigTestResult( Tomahawk::Accounts::ConfigTestResultType ) ) ); }
void PackagesDelegate::invalidateWidgetPositions () { QTreeView *view = qobject_cast<QTreeView*> (parent ()); QAbstractItemModel *model = view->model (); for (int i = 0, rows = model->rowCount (); i < rows; ++i) emit sizeHintChanged (model->index (i, 0)); }
QWidget* ibanBicItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const { Q_UNUSED(option); ibanBicItemEdit* edit = new ibanBicItemEdit(parent); connect(edit, SIGNAL(commitData(QWidget*)), this, SIGNAL(commitData(QWidget*))); connect(edit, SIGNAL(closeEditor(QWidget*)), this, SIGNAL(closeEditor(QWidget*))); emit sizeHintChanged(index); return edit; }
ContactsViewDelegate::ContactsViewDelegate(ContactsView *v) : QAbstractItemDelegate(v), view(v), contactDelegate(this), m_alertAnimation(0), m_alertOpacity(0) { contactDelegate.setParent(0); QAbstractItemDelegate *d = &contactDelegate; do { connect(d, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)), SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint))); connect(d, SIGNAL(commitData(QWidget*)), SIGNAL(commitData(QWidget*))); connect(d, SIGNAL(sizeHintChanged(QModelIndex)), SIGNAL(sizeHintChanged(QModelIndex))); if (d == &contactDelegate) d = &identityDelegate; else d = 0; } while (d); }
void ItemDelegate::dataChanged(const QModelIndex &a, const QModelIndex &b) { // recalculating sizes of many items is expensive (when searching) // - assume that highlighted (matched) text has same size // - recalculate size only if item edited int row = a.row(); if ( row == b.row() ) { removeCache(row); emit sizeHintChanged(a); } }
bool LfmDelegate::eventFilter( QObject* obj, QEvent* event ) { if( event->type() == QEvent::Resize ) { QWidget* view = qobject_cast< QWidget* >(obj ); if( !view ) return false; m_viewSize = view->size(); emit sizeHintChanged( QModelIndex() ); } return false; }
void AnimatedSplitter::addWidget( AnimatedWidget* widget ) { QSplitter::addWidget( widget ); connect( widget, SIGNAL( showWidget() ), SLOT( onShowRequest() ) ); connect( widget, SIGNAL( hideWidget() ), SLOT( onHideRequest() ) ); connect( widget, SIGNAL( sizeHintChanged( QSize ) ), SLOT( onShowRequest() ) ); connect( widget, SIGNAL( sizeChanged( QSize ) ), SLOT( onSizeChanged( QSize ) ) ); connect( this, SIGNAL( shown( QWidget*, bool ) ), widget, SLOT( onShown( QWidget*, bool ) ) ); connect( this, SIGNAL( hidden( QWidget*, bool ) ), widget, SLOT( onHidden( QWidget*, bool ) ) ); }
void TwitterConfigWidget::deauthenticateTwitter() { qDebug() << Q_FUNC_INFO; m_plugin->setTwitterOAuthToken( QString() ); m_plugin->setTwitterOAuthTokenSecret( QString() ); m_plugin->setTwitterScreenName( QString() ); ui->twitterStatusLabel->setText(tr("Status: No saved credentials")); ui->twitterAuthenticateButton->setText( tr( "Authenticate" ) ); ui->twitterSyncGroupBox->setVisible( false ); emit twitterAuthed( false ); emit sizeHintChanged(); }
void KipiImageItemDelegate::setThumbnailSize(const int size) { d->thumbnailSize = size; KipiImageModel* const imageModel = d->imageList->getModel(); if (!imageModel) return; if (imageModel->rowCount() > 0) { // TODO: is it enough to emit this signal for only 1 item? // seems to work in Qt4.5 with QTreeView::setUniformRowHeights(true) emit(sizeHintChanged(imageModel->index(0, 0))); } }
void TwitterConfigWidget::deauthenticateTwitter() { qDebug() << Q_FUNC_INFO; QVariantHash credentials = m_account->credentials(); credentials[ "oauthtoken" ] = QString(); credentials[ "oauthtokensecret" ] = QString(); credentials[ "username" ] = QString(); m_account->setCredentials( credentials ); m_ui->twitterStatusLabel->setText(tr("Status: No saved credentials")); m_ui->twitterAuthenticateButton->setText( tr( "Authenticate" ) ); m_ui->twitterSyncGroupBox->setVisible( false ); emit twitterAuthed( false ); emit sizeHintChanged(); }
void ItemDelegate::setIndexWidget(const QModelIndex &index, ItemWidget *w) { const int row = index.row(); delete m_cache[row]; if (w == NULL) { m_cache[row]; return; } w->widget()->setMaximumSize(m_maxSize); w->updateSize(); m_cache[row] = w; emit sizeHintChanged(index); w->widget()->installEventFilter(this); }
void Context::Applet::collapse( bool on ) { qreal finalHeight = ( on ) ? m_heightCollapseOn : m_heightCollapseOff; const qreal maxHeight = containment()->size().height(); if( (finalHeight > maxHeight) || (finalHeight < 0) ) finalHeight = maxHeight; prepareGeometryChange(); // warning: view() currently can return pointer to ToolbarView, not the ContextView ContextView *v = ContextView::self(); // may return null // Plasma::Applet::view() might return 0, if the widget is not yet constructed, etc. // \sa https://bugs.kde.org/show_bug.cgi?id=258741. If view is not available // yet, regardless of the animation setting the preferred size is set // straight away. if( !v || !AmarokConfig::animateAppletCollapse() ) { setPreferredHeight( finalHeight ); emit sizeHintChanged( Qt::PreferredSize ); updateGeometry(); return; } if( finalHeight == size().height() ) return; // debug() << pluginName() << (on ? "collapsing to" : "uncollapsing to") << finalHeight; QPropertyAnimation *pan = m_animation.data(); if( !pan ) pan = new QPropertyAnimation( this, "preferredSize" ); if( pan->state() == QAbstractAnimation::Running ) pan->stop(); pan->setDuration( 600 ); pan->setEasingCurve( QEasingCurve::InQuad ); pan->setStartValue( size() ); pan->setEndValue( QSizeF(size().width(), finalHeight) ); connect( pan, SIGNAL(finished()), SLOT(collapseAnimationFinished()) ); m_animation = pan; pan->setDirection( QAbstractAnimation::Forward ); v->addCollapseAnimation( pan ); }
QWidget* LedgerDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const { Q_UNUSED(option); if(index.isValid()) { Q_ASSERT(parent); LedgerView* view = qobject_cast<LedgerView*>(parent->parentWidget()); Q_ASSERT(view != 0); if(view->selectionModel()->selectedRows().count() > 1) { qDebug() << "Editing multiple transactions at once is not yet supported"; /** * @todo replace the following three lines with the creation of a special * editor that can handle multiple transactions at once */ d->m_editor = 0; LedgerDelegate* const that = const_cast<LedgerDelegate* const>(this); emit that->closeEditor(d->m_editor, NoHint); } else { d->m_editor = new NewTransactionEditor(parent, view->accountId()); d->m_editor->setInvertSign(view->isSignInverted()); } if(d->m_editor) { d->m_editorRow = index.row(); connect(d->m_editor, SIGNAL(done()), this, SLOT(endEdit())); emit sizeHintChanged(index); } } else { qFatal("LedgerDelegate::createEditor(): we should never end up here"); } return d->m_editor; }
QSize KDChart::TextLayoutItem::sizeHintAndRotatedCorners( QPoint& topLeftPt, QPoint& topRightPt, QPoint& bottomRightPt, QPoint& bottomLeftPt) const { if( realFontWasRecalculated() || mAttributes.rotation() ) { const QSize newSizeHint( calcSizeHint( cachedFont, topLeftPt, topRightPt, bottomRightPt, bottomLeftPt ) ); if( newSizeHint != cachedSizeHint ){ cachedSizeHint = newSizeHint; sizeHintChanged(); } cachedTopLeft = topLeftPt; cachedTopRight = topRightPt; cachedBottomRight = bottomRightPt; cachedBottomLeft = bottomLeftPt; }else{ topLeftPt = cachedTopLeft; topRightPt = cachedTopRight; bottomRightPt = cachedBottomRight; bottomLeftPt = cachedBottomLeft; } //qDebug() << "-------- KDChart::TextLayoutItem::sizeHint() returns:"<<cachedSizeHint<<" ----------"; return cachedSizeHint; }
void QmlConsoleItemDelegate::emitSizeHintChanged(const QModelIndex &index) { emit sizeHintChanged(index); }
void QmlConsoleItemDelegate::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { emit sizeHintChanged(current); emit sizeHintChanged(previous); }
void LayerListDelegate::setShowNumbers(bool show) { m_showNumbers = show; emit sizeHintChanged(QModelIndex()); // trigger repaint }
void TestResultDelegate::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { emit sizeHintChanged(current); emit sizeHintChanged(previous); }
bool SideWidget::event(QEvent *event) { if (event->type() == QEvent::LayoutRequest) emit sizeHintChanged(); return QWidget::event(event); }
void Clock::clockConfigAccepted() { KConfigGroup cg = config(); m_showTimezone = ui.showTimeZone->isChecked(); cg.writeEntry("showTimezone", m_showTimezone); if (m_isDefaultFont && ui.plainClockFont->currentFont() != m_plainClockFont) { m_isDefaultFont = false; } m_plainClockFont = ui.plainClockFont->currentFont(); //We need this to happen before we disconnect/reconnect sources to ensure //that the update interval is set properly. if (m_showSeconds != ui.secondsCheckbox->isChecked()) { m_showSeconds = !m_showSeconds; cg.writeEntry("showSeconds", m_showSeconds); if (m_showSeconds) { //We don't need to cache the applet if it update every second setCacheMode(QGraphicsItem::NoCache); } else { setCacheMode(QGraphicsItem::DeviceCoordinateCache); } changeEngineTimezone(currentTimezone(), currentTimezone()); } m_dateStyle = ui.dateStyle->currentIndex(); cg.writeEntry("dateStyle", m_dateStyle); m_showSeconds = ui.secondsCheckbox->checkState() == Qt::Checked; cg.writeEntry("showSeconds", m_showSeconds); m_useCustomColor = ui.useCustomColor->isChecked(); cg.writeEntry("useCustomColor", m_useCustomColor); if (m_useCustomColor) { m_plainClockColor = ui.plainClockColor->color(); cg.writeEntry("plainClockColor", m_plainClockColor); m_pixmap = QPixmap(); delete m_svg; m_svg = 0; } else { m_plainClockColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor); } m_useCustomShadowColor = ui.useCustomShadowColor->isChecked(); cg.writeEntry("useCustomShadowColor", m_useCustomShadowColor); if (m_useCustomShadowColor) { m_plainClockShadowColor = ui.plainClockShadowColor->color(); cg.writeEntry("plainClockShadowColor", m_plainClockShadowColor); } else { m_plainClockShadowColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor); } m_drawShadow = ui.drawShadow->isChecked(); cg.writeEntry("plainClockDrawShadow", m_drawShadow); m_plainClockFont.setBold(ui.plainClockFontBold->checkState() == Qt::Checked); m_plainClockFont.setItalic(ui.plainClockFontItalic->checkState() == Qt::Checked); cg.writeEntry("plainClockFont", m_plainClockFont); constraintsEvent(Plasma::SizeConstraint); generatePixmap(); update(); emit sizeHintChanged(Qt::PreferredSize); emit configNeedsSaving(); }
void Clock::updateSize() { Plasma::FormFactor f = formFactor(); if (f != Plasma::Vertical && f != Plasma::Horizontal) { const QFontMetricsF metrics(KGlobalSettings::smallestReadableFont()); // calculates based on size of "23:59"! const QString timeString = KGlobal::locale()->formatTime(QTime(23, 59), m_showSeconds); setMinimumSize(metrics.size(Qt::TextSingleLine, timeString)); } // more magic numbers int aspect = 2; if (m_showSeconds) { aspect = 3; } int w, h; if (m_dateStyle || showTimezone()) { const QFont f(KGlobalSettings::smallestReadableFont()); const QFontMetrics metrics(f); // if there's enough vertical space, wrap the words if (contentsRect().height() < f.pointSize() * 6) { QSize s = metrics.size(Qt::TextSingleLine, m_dateString); w = s.width() + metrics.width(" "); h = f.pointSize(); //kDebug(96669) << "uS: singleline" << w; } else { QSize s = metrics.size(Qt::TextWordWrap, m_dateString); w = s.width(); h = f.pointSize(); //kDebug(96669) << "uS: wordwrap" << w; } if (!m_dateTimezoneBesides) { w = qMax(w, (int)(contentsRect().height() * aspect)); h = h+(int)(contentsRect().width() / aspect); } else { w = w+(int)(contentsRect().height() * aspect); h = qMax(h, (int)(contentsRect().width() / aspect)); } } else { w = (int)(contentsRect().height() * aspect); h = (int)(contentsRect().width() / aspect); } if (f == Plasma::Horizontal) { // We have a fixed height, set some sensible width setMinimumSize(QSize(w, 0)); //kDebug() << "DR" << m_dateRect.width() << "CR" << contentsRect().height() * aspect; // kDebug(96669) << contentsRect(); } else { // We have a fixed width, set some sensible height setMinimumSize(QSize(0, h)); } setPreferredSize(QSize(w, h)); emit sizeHintChanged(Qt::PreferredSize); //kDebug(96669) << "minZize: " << minimumSize() << preferredSize(); if (m_isDefaultFont) { const QString fakeTimeString = KGlobal::locale()->formatTime(QTime(23,59,59), m_showSeconds); expandFontToMax(m_plainClockFont, fakeTimeString); } generatePixmap(); update(); }
void ElementItemDelegate::sizeHintChangedBridge(const QModelIndex & index) { emit sizeHintChanged(index); }