Ejemplo n.º 1
0
bool HGLayout::removeItem(QGraphicsLayoutItem *item)
{
    if (!layout()) return false;

    switch (layoutType()) {
    case HEnums::kVBox:
    case HEnums::kHBox: {
        QGraphicsLinearLayout* l = static_cast<QGraphicsLinearLayout*>(layout());
        l->removeItem(item);
        break;
    }
    case HEnums::kGrid: {
        QGraphicsGridLayout* l = static_cast<QGraphicsGridLayout*>(layout());
        l->removeItem(item);
        break;
    }
    case HEnums::kAnchor: {//"anchor layout can't remove item now!"
        QGraphicsAnchorLayout* l = static_cast<QGraphicsAnchorLayout*>(layout());
        Q_UNUSED(l);

        return false;
    }
    default:
        return false;
    }
    return true;
}
Ejemplo n.º 2
0
void Albums::closeFilterBar()
{
    filterTextChanged( QString() );
    AlbumsFilterBar *bar = static_cast<AlbumsFilterBar*>( sender() );
    QGraphicsLinearLayout *l = static_cast<QGraphicsLinearLayout*>( layout() );
    l->removeItem( bar );
    bar->deleteLater();
    m_filterIcon->setEnabled( true );
}
Ejemplo n.º 3
0
void
TabsApplet::updateInterface( const AppletState appletState )
{
    // return if state has not changed (except for init state)
    if( m_currentState == appletState && appletState != InitState )
        return;

    debug() << "updating interface from state " << m_currentState << " to " << appletState;
    m_currentState = appletState;
    bool collapse = false;

    switch( m_currentState )
    {
        case InitState:
        case StoppedState:
            m_reloadIcon.data()->setEnabled( false );
            m_showTabBrowser = false;
            collapse = true;
            break;
        case NoTabsState:
            m_reloadIcon.data()->setEnabled( true );
            m_showTabBrowser = false;
            collapse = true;
            break;
        case FetchingState:
            m_reloadIcon.data()->setEnabled( false );
            m_showTabBrowser = false;
            break;
        case TabState:
            m_reloadIcon.data()->setEnabled( true );
            m_showTabBrowser = true;
            break;
    }

    QGraphicsLinearLayout *lo = static_cast<QGraphicsLinearLayout*>( layout() );

    m_showTabBrowser ? lo->addItem( m_tabsView ) : lo->removeItem( m_tabsView );
    m_showTabBrowser ? m_tabsView->show() : m_tabsView->hide();

    collapse ? setCollapseOn() : setCollapseOff();

    updateConstraints();
    update();
}
void 
ThemeWidget::textChanged ()
{
    if (!m_List->filtering()->editor()->isOnDisplay()) {
        m_List->filtering()->editor()->show();
        m_List->filtering()->editor()->setFocus();
    }

    QGraphicsLinearLayout *mainLayout = dynamic_cast<QGraphicsLinearLayout *>(layout ());
    if (mainLayout)
    {
      if (m_LiveFilterEditor->text ().isEmpty () == true)
      {
          /*
           * We already have a better solution for this in the soundsettings
           * applet...
           */
          mainLayout->removeItem (m_LiveFilterEditor);
          m_LiveFilterEditor->setPos (QPointF (0.,-200.));
      }
      else
      {
          mainLayout->insertItem (0, m_LiveFilterEditor);
      }  
      mainLayout->invalidate ();
    }

    m_CellCreator->highlightByText (m_LiveFilterEditor->text());
    // Seems that the sort() method simply will not sort when the
    // ThemeListModel::SearchRole is used.
    m_Proxy->sort(Qt::DisplayRole);
    
    /*
     * As the search string changes the current theme might appear in the list
     * (if the current theme was filtered before). In this case we need to
     * select this item in the list, because the selection is lost when the
     * selected item is filtered out.
     */
    selectCurrentTheme ();
    m_ThemeListModel->refresh();

    update ();
}