void SpinBox::resizeEvent(QGraphicsSceneResizeEvent *event) { QGraphicsProxyWidget::resizeEvent(event); QStyleOptionSpinBox spinOpt; spinOpt.initFrom(nativeWidget()); QRect controlrect = nativeWidget()->style()->subControlRect(QStyle::CC_SpinBox, &spinOpt, QStyle::SC_SpinBoxFrame, nativeWidget()); if (d->focusIndicator) { d->focusIndicator->setCustomGeometry(controlrect); } }
void AlbumsView::resizeEvent( QGraphicsSceneResizeEvent *event ) { QGraphicsProxyWidget::resizeEvent( event ); const int newWidth = size().width() / nativeWidget()->header()->count(); for( int i = 0; i < nativeWidget()->header()->count(); ++i ) nativeWidget()->header()->resizeSection( i, newWidth ); nativeWidget()->setColumnWidth( 0, 100 ); }
Meta::TrackList AlbumsView::getSelectedTracks() const { Meta::TrackList selected; const QStandardItemModel *itemModel = static_cast<QStandardItemModel*>( const_cast<AlbumsView*>(this)->model()); QModelIndexList indexes = static_cast<AlbumsTreeView*>(nativeWidget())->selectedIndexes(); foreach( const QModelIndex &index, indexes ) { if( index.isValid() ) { QStandardItem *item = itemModel->itemFromIndex( index ); AlbumItem *album = dynamic_cast<AlbumItem*>(item); if( album ) { selected << album->album()->tracks(); continue; } TrackItem *track = dynamic_cast<TrackItem*>(item); if( track ) selected << track->track(); } } return selected; }
QSizeF PushButton::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const { QSizeF hint = QGraphicsProxyWidget::sizeHint(which, constraint); if (hint.isEmpty()) { return hint; } //replace the native margin with the Svg one QStyleOption option; option.initFrom(nativeWidget()); int nativeMargin = nativeWidget()->style()->pixelMetric(QStyle::PM_ButtonMargin, &option, nativeWidget()); qreal left, top, right, bottom; d->background->getMargins(left, top, right, bottom); hint = hint - QSize(nativeMargin, nativeMargin) + QSize(left+right, top+bottom); return hint; }
void PushButton::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { if (nativeWidget()->isDown() || d->background->hasElementPrefix("hover")) { return; } d->hoverAnimation->setProperty("duration", 150); d->background->setElementPrefix("active"); d->hoverAnimation->setProperty("startPixmap", d->background->framePixmap()); d->background->setElementPrefix("normal"); d->hoverAnimation->setProperty("targetPixmap", d->background->framePixmap()); d->hoverAnimation->start(); QGraphicsProxyWidget::hoverLeaveEvent(event); }
void AlbumsView::contextMenuEvent( QGraphicsSceneContextMenuEvent *event ) { KAction *appendAction = new KAction( KIcon( "media-track-add-amarok" ), i18n( "&Append to Playlist" ), this ); KAction *loadAction = new KAction( KIcon( "folder-open" ), i18nc( "Replace the currently loaded tracks with these", "&Load" ), this ); KAction *queueAction = new KAction( KIcon( "media-track-queue-amarok" ), i18n( "&Queue" ), this ); KAction *editAction = new KAction( KIcon( "media-track-edit-amarok" ), i18n( "Edit Track Details" ), this ); connect( appendAction, SIGNAL( triggered() ), this, SLOT( slotAppendSelected() ) ); connect( loadAction , SIGNAL( triggered() ), this, SLOT( slotPlaySelected() ) ); connect( queueAction , SIGNAL( triggered() ), this, SLOT( slotQueueSelected() ) ); connect( editAction , SIGNAL( triggered() ), this, SLOT( slotEditSelected() ) ); KMenu menu; menu.addAction( appendAction ); menu.addAction( loadAction ); menu.addAction( queueAction ); menu.addSeparator(); menu.addAction( editAction ); QModelIndex index = nativeWidget()->indexAt( event->pos().toPoint() ); if( index.isValid() ) { QStandardItem *item = static_cast<QStandardItemModel*>( model() )->itemFromIndex( index ); AlbumItem *album = dynamic_cast<AlbumItem*>(item); if( album ) { Meta::AlbumPtr albumPtr = album->album(); Meta::CustomActionsCapability *cac = albumPtr->create<Meta::CustomActionsCapability>(); if( cac ) { QList<PopupDropperAction *> actions = cac->customActions(); menu.addSeparator(); foreach( PopupDropperAction *action, actions ) menu.addAction( action ); } } } menu.exec( event->screenPos() ); }
//------------------------------------------------------------------------------ void SCgLineEdit::setEchoMode(EchoMode echoMode) { nativeWidget()->setEchoMode(convertToQEchoModeType(echoMode)); }
//------------------------------------------------------------------------------ bool SCgLineEdit::hasFrame() const { return nativeWidget()->hasFrame(); }
//------------------------------------------------------------------------------ void SCgLineEdit::setMaxLength(int maxLength) { nativeWidget()->setMaxLength(maxLength); }
//------------------------------------------------------------------------------ void SCgLineEdit::setPlaceholderText(const QString &placeholderText) { nativeWidget()->setPlaceholderText(placeholderText); }
//------------------------------------------------------------------------------ QString SCgLineEdit::displayText() const { return nativeWidget()->displayText(); }
//------------------------------------------------------------------------------ void SCgLineEdit::paste() { nativeWidget()->paste(); }
QMenu * SCgLineEdit::createStandardContextMenu() { return nativeWidget()->createStandardContextMenu(); }
//------------------------------------------------------------------------------ void SCgLineEdit::insert(const QString &newText) { nativeWidget()->insert(newText); }
//------------------------------------------------------------------------------ void SCgLineEdit::deselect() { nativeWidget()->deselect(); }
void SCgLineEdit::cut() { return nativeWidget()->cut(); }
//------------------------------------------------------------------------------ void SCgLineEdit::copy() const { nativeWidget()->copy(); }
//------------------------------------------------------------------------------ QVariant SCgLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const { return nativeWidget()->inputMethodQuery(property); }
//------------------------------------------------------------------------------ QString SCgLineEdit::text() const { return nativeWidget()->text(); }
//------------------------------------------------------------------------------ bool SCgLineEdit::event(QEvent *e) { return nativeWidget()->event(e); }
//------------------------------------------------------------------------------ QString SCgLineEdit::placeholderText() const { return nativeWidget()->placeholderText(); }
//------------------------------------------------------------------------------ void SCgLineEdit::setText(const QString &text) { nativeWidget()->setText(text); }
//------------------------------------------------------------------------------ int SCgLineEdit::maxLength() const { return nativeWidget()->maxLength(); }
//------------------------------------------------------------------------------ void SCgLineEdit::clear() { nativeWidget()->clear(); }
//------------------------------------------------------------------------------ void SCgLineEdit::setFrame(bool b) { nativeWidget()->setFrame(b); }
//------------------------------------------------------------------------------ void SCgLineEdit::selectAll() { nativeWidget()->selectAll(); }
//------------------------------------------------------------------------------ SCgLineEdit::EchoMode SCgLineEdit::echoMode() const { return convertToScgEchoModeType(nativeWidget()->echoMode()); }
//------------------------------------------------------------------------------ void SCgLineEdit::undo() { nativeWidget()->undo(); }
//------------------------------------------------------------------------------ bool SCgLineEdit::isReadOnly() const { return nativeWidget()->isReadOnly(); }
//------------------------------------------------------------------------------ void SCgLineEdit::redo() { nativeWidget()->redo(); }