Beispiel #1
0
QPixmap KItemListWidget::createDragPixmap(const QStyleOptionGraphicsItem* option,
                                          QWidget* widget)
{
    QPixmap pixmap(size().toSize() * widget->devicePixelRatio());
    pixmap.setDevicePixelRatio(widget->devicePixelRatio());
    pixmap.fill(Qt::transparent);

    QPainter painter(&pixmap);

    const bool oldAlternateBackground = m_alternateBackground;
    const bool wasSelected = m_selected;
    const bool wasHovered = m_hovered;

    setAlternateBackground(false);
    setSelected(false);
    setHovered(false);

    paint(&painter, option, widget);

    setAlternateBackground(oldAlternateBackground);
    setSelected(wasSelected);
    setHovered(wasHovered);

    return pixmap;
}
void ContactListView::setAlternateBackgroundEnabled(bool enabled)
{
  mABackground = enabled;

  if (mABackground)
  {
    setAlternateBackground(mAlternateColor);
  }
  else
  {
    setAlternateBackground(QColor());
  }
}
Beispiel #3
0
K3bFileTreeView::K3bFileTreeView( QWidget *parent, const char *name )
  : KFileTreeView( parent,  name )
{
  d = new Private();

  d->toolTip = new K3bDeviceTreeToolTip( viewport(), this );

  addColumn( i18n("Directories") );
  setDragEnabled( true );
  setAlternateBackground( QColor() );
  setFullWidth(true);
  //  setRootIsDecorated(true);
  setSorting(0);

  m_dirOnlyMode = true;
  m_menuEnabled = false;

  connect( this, SIGNAL(executed(QListViewItem*)), this, SLOT(slotItemExecuted(QListViewItem*)) );
  connect( this, SIGNAL(returnPressed(QListViewItem*)), this, SLOT(slotItemExecuted(QListViewItem*)) );
  connect( this, SIGNAL(contextMenu(KListView*, QListViewItem* , const QPoint& )),
	   this, SLOT(slotContextMenu(KListView*, QListViewItem* , const QPoint& )) );

  // we always simulate the single click
  slotSettingsChangedK3b(KApplication::SETTINGS_MOUSE);
  if( kapp )
    connect( kapp, SIGNAL(settingsChanged(int)), SLOT(slotSettingsChangedK3b(int)) );

  initActions();
}
void KNCollectionView::readConfig()
{
    KConfig *conf = knGlobals.config();
    conf->setGroup("GroupView");

    // execute the listview layout stuff only once
    static bool initDone = false;
    if(!initDone)
    {
        initDone = true;
        const int unreadColumn = conf->readNumEntry("UnreadColumn", 1);
        const int totalColumn = conf->readNumEntry("TotalColumn", 2);

        // we need to _activate_ them in the correct order
        // this is ugly because we can't use header()->moveSection
        // but otherwise the restoreLayout doesn't know that to do
        if(unreadColumn != -1 && unreadColumn < totalColumn)
            addUnreadColumn(i18n("Unread"), 48);
        if(totalColumn != -1)
            addTotalColumn(i18n("Total"), 36);
        if(unreadColumn != -1 && unreadColumn > totalColumn)
            addUnreadColumn(i18n("Unread"), 48);
        updatePopup();

        restoreLayout(knGlobals.config(), "GroupView");
    }

    // font & color settings
    KNConfig::Appearance *app = knGlobals.configManager()->appearance();
    setFont(app->groupListFont());

    QPalette p = palette();
    p.setColor(QColorGroup::Base, app->backgroundColor());
    p.setColor(QColorGroup::Text, app->textColor());
    setPalette(p);
    setAlternateBackground(app->backgroundColor());
    // FIXME: make this configurable
    mPaintInfo.colUnread = QColor("blue");
    mPaintInfo.colFore = app->textColor();
    mPaintInfo.colBack = app->backgroundColor();
}