Exemple #1
0
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;
}
Exemple #4
0
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;
}
Exemple #5
0
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() );
}
Exemple #7
0
//------------------------------------------------------------------------------
void SCgLineEdit::setEchoMode(EchoMode echoMode)
{
    nativeWidget()->setEchoMode(convertToQEchoModeType(echoMode));
}
Exemple #8
0
//------------------------------------------------------------------------------
bool SCgLineEdit::hasFrame() const
{
    return nativeWidget()->hasFrame();
}
Exemple #9
0
//------------------------------------------------------------------------------
void SCgLineEdit::setMaxLength(int maxLength)
{
    nativeWidget()->setMaxLength(maxLength);
}
Exemple #10
0
//------------------------------------------------------------------------------
void SCgLineEdit::setPlaceholderText(const QString &placeholderText)
{
    nativeWidget()->setPlaceholderText(placeholderText);
}
Exemple #11
0
//------------------------------------------------------------------------------
QString SCgLineEdit::displayText() const
{
    return nativeWidget()->displayText();
}
Exemple #12
0
//------------------------------------------------------------------------------
void SCgLineEdit::paste()
{
    nativeWidget()->paste();
}
Exemple #13
0
QMenu * SCgLineEdit::createStandardContextMenu()
{
    return nativeWidget()->createStandardContextMenu();
}
Exemple #14
0
//------------------------------------------------------------------------------
void SCgLineEdit::insert(const QString &newText)
{
    nativeWidget()->insert(newText);
}
Exemple #15
0
//------------------------------------------------------------------------------
void SCgLineEdit::deselect()
{
    nativeWidget()->deselect();
}
Exemple #16
0
void SCgLineEdit::cut()
{
    return nativeWidget()->cut();
}
Exemple #17
0
//------------------------------------------------------------------------------
void SCgLineEdit::copy() const
{
    nativeWidget()->copy();
}
Exemple #18
0
//------------------------------------------------------------------------------
QVariant SCgLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const
{
    return nativeWidget()->inputMethodQuery(property);
}
Exemple #19
0
//------------------------------------------------------------------------------
QString SCgLineEdit::text() const
{
    return nativeWidget()->text();
}
Exemple #20
0
//------------------------------------------------------------------------------
bool SCgLineEdit::event(QEvent *e)
{
    return nativeWidget()->event(e);
}
Exemple #21
0
//------------------------------------------------------------------------------
QString SCgLineEdit::placeholderText() const
{
    return nativeWidget()->placeholderText();
}
Exemple #22
0
//------------------------------------------------------------------------------
void SCgLineEdit::setText(const QString &text)
{
    nativeWidget()->setText(text);
}
Exemple #23
0
//------------------------------------------------------------------------------
int SCgLineEdit::maxLength() const
{
    return nativeWidget()->maxLength();
}
Exemple #24
0
//------------------------------------------------------------------------------
void SCgLineEdit::clear()
{
    nativeWidget()->clear();
}
Exemple #25
0
//------------------------------------------------------------------------------
void SCgLineEdit::setFrame(bool b)
{
    nativeWidget()->setFrame(b);
}
Exemple #26
0
//------------------------------------------------------------------------------
void SCgLineEdit::selectAll()
{
    nativeWidget()->selectAll();
}
Exemple #27
0
//------------------------------------------------------------------------------
SCgLineEdit::EchoMode SCgLineEdit::echoMode() const
{
    return convertToScgEchoModeType(nativeWidget()->echoMode());
}
Exemple #28
0
//------------------------------------------------------------------------------
void SCgLineEdit::undo()
{
    nativeWidget()->undo();
}
Exemple #29
0
//------------------------------------------------------------------------------
bool SCgLineEdit::isReadOnly() const
{
    return nativeWidget()->isReadOnly();
}
Exemple #30
0
//------------------------------------------------------------------------------
void SCgLineEdit::redo()
{
    nativeWidget()->redo();
}