Exemplo n.º 1
0
//BEGIN KateStyleTreeWidget
KateStyleTreeWidget::KateStyleTreeWidget( QWidget *parent, bool showUseDefaults )
    : QTreeWidget( parent )
{
  setItemDelegate(new KateStyleTreeDelegate(this));
  setRootIsDecorated(false);

  QStringList headers;
  headers << i18nc("@title:column Meaning of text in editor", "Context") << QString() << QString() << QString() << QString() << i18nc("@title:column Text style", "Normal") << i18nc("@title:column Text style", "Selected") << i18nc("@title:column Text style", "Background") << i18nc("@title:column Text style", "Background Selected");
  if(showUseDefaults) {
    headers << i18n("Use Default Style");
  }

  setHeaderLabels(headers);

  headerItem()->setIcon(1, KIcon("format-text-bold"));
  headerItem()->setIcon(2, KIcon("format-text-italic"));
  headerItem()->setIcon(3, KIcon("format-text-underline"));
  headerItem()->setIcon(4, KIcon("format-text-strikethrough"));

  // grap the bg color, selected color and default font
  normalcol = KColorScheme(QPalette::Active, KColorScheme::View).foreground().color();
  bgcol = KateRendererConfig::global()->backgroundColor();
  selcol = KateRendererConfig::global()->selectionColor();
  docfont = KateRendererConfig::global()->font();

  QPalette pal = viewport()->palette();
  pal.setColor(QPalette::Background, bgcol);
  viewport()->setPalette( pal );
}
Exemplo n.º 2
0
void TotalMultipleScoresList::addLineItem(const ItemArray &si,
                                          uint index, QTreeWidgetItem *line)
{
//   kDebug(11001) ;
    const PlayerInfos &pi = internal->playerInfos();
    uint k = 1; // skip "id"
    for (uint i=0; i<4; i++) { // skip additional fields
        const ItemContainer *container;
        if ( i==2 ) container = pi.item(QLatin1String( "nb games" ));
        else if ( i==3 ) container = pi.item(QLatin1String( "mean score" ));
        else {
            container = si[k];
            k++;
        }

        if (line) {
	  line->setText(i, itemText(*container, index));
	  line->setTextAlignment(i, container->item()->alignment());
	}
        else {
            QString label =
                (i==2 ? i18n("Won Games") : container->item()->label());
	    headerItem()->setText(i, label );
            headerItem()->setTextAlignment(i, container->item()->alignment());
        }
    }
}
Exemplo n.º 3
0
ScanGallery::ScanGallery(QWidget *parent)
    : FileTreeView(parent)
{
    setObjectName("ScanGallery");

    //header()->setStretchEnabled(true,0);		// do we like this effect?

    setColumnCount(3);
    setRootIsDecorated(false);
    //setSortingEnabled(true);
    //sortByColumn(0, Qt::AscendingOrder);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);

    QStringList labels;
    labels << i18n("Name");
    labels << i18n("Size");
    labels << i18n("Format");
    setHeaderLabels(labels);

    headerItem()->setTextAlignment(0, Qt::AlignLeft);
    headerItem()->setTextAlignment(1, Qt::AlignLeft);
    headerItem()->setTextAlignment(2, Qt::AlignLeft);

    // Drag and Drop
    setDragEnabled(true);				// allow drags out
    model()->setSupportedDragActions(Qt::CopyAction|Qt::MoveAction);

    setAcceptDrops(true);				// allow drops in
    connect(this, SIGNAL(dropped(QDropEvent *,FileTreeViewItem *)),
            SLOT(slotUrlsDropped(QDropEvent *,FileTreeViewItem *)));

   connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)),
           SLOT(slotItemHighlighted(QTreeWidgetItem *)));
   connect(this, SIGNAL(itemActivated(QTreeWidgetItem *,int)),
           SLOT(slotItemActivated(QTreeWidgetItem *)));
   connect(this, SIGNAL(fileRenamed(FileTreeViewItem *,const QString &)),
           SLOT(slotFileRenamed(FileTreeViewItem *,const QString &)));
   connect(this, SIGNAL(itemExpanded(QTreeWidgetItem *)),
           SLOT(slotItemExpanded(QTreeWidgetItem *)));

    /* Preload frequently used icons */
    KIconLoader::global()->addAppDir("libkscan");	// access to library icons
    mPixFloppy = KIconLoader::global()->loadIcon("media-floppy", KIconLoader::NoGroup, KIconLoader::SizeSmall);
    mPixGray   = KIconLoader::global()->loadIcon("palette-gray", KIconLoader::NoGroup, KIconLoader::SizeSmall);
    mPixBw     = KIconLoader::global()->loadIcon("palette-lineart", KIconLoader::NoGroup, KIconLoader::SizeSmall);
    mPixColor  = KIconLoader::global()->loadIcon("palette-color", KIconLoader::NoGroup, KIconLoader::SizeSmall);

    m_startup = true;
    m_currSelectedDir = KUrl();
    mSaver = NULL;
    mSavedTo = NULL;

    /* create a context menu and set the title */
    m_contextMenu = new KMenu();
    m_contextMenu->addTitle(i18n("Gallery"));
}
Exemplo n.º 4
0
/* QKeyList */
QKeyList::QKeyList(plKey container, QWidget* parent)
        : QTreeWidget(parent), fContainer(container)
{
    setColumnCount(2);
    setUniformRowHeights(true);
    setRootIsDecorated(false);
    headerItem()->setText(0, tr("Name"));
    headerItem()->setText(1, tr("Type"));

    connect(this, SIGNAL(itemActivated(QTreeWidgetItem*, int)),
            this, SLOT(activateKeyItem(QTreeWidgetItem*, int)));
}
Exemplo n.º 5
0
/* QPythonParamList */
QPythonParamList::QPythonParamList(QWidget* parent)
                : QTreeWidget(parent)
{
    setColumnCount(3);
    setUniformRowHeights(true);
    setRootIsDecorated(false);
    headerItem()->setText(0, tr("Id"));
    headerItem()->setText(1, tr("Type"));
    headerItem()->setText(2, tr("Value"));

    connect(this, SIGNAL(itemActivated(QTreeWidgetItem*, int)),
            this, SLOT(handleActivate(QTreeWidgetItem*, int)));
}
Exemplo n.º 6
0
FeedListWidget::FeedListWidget(QWidget *parent)
    : QTreeWidget(parent)
{
    setContextMenuPolicy(Qt::CustomContextMenu);
    setDragDropMode(QAbstractItemView::InternalMove);
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setColumnCount(1);
    headerItem()->setText(0, tr("RSS feeds"));

    connect(RSS::Session::instance(), &RSS::Session::itemAdded, this, &FeedListWidget::handleItemAdded);
    connect(RSS::Session::instance(), &RSS::Session::feedStateChanged, this, &FeedListWidget::handleFeedStateChanged);
    connect(RSS::Session::instance(), &RSS::Session::feedIconLoaded, this, &FeedListWidget::handleFeedIconLoaded);
    connect(RSS::Session::instance(), &RSS::Session::itemPathChanged, this, &FeedListWidget::handleItemPathChanged);
    connect(RSS::Session::instance(), &RSS::Session::itemAboutToBeRemoved, this, &FeedListWidget::handleItemAboutToBeRemoved);

    m_rssToTreeItemMapping[RSS::Session::instance()->rootFolder()] = invisibleRootItem();

    m_unreadStickyItem = new QTreeWidgetItem(this);
    m_unreadStickyItem->setData(0, Qt::UserRole, reinterpret_cast<quintptr>(RSS::Session::instance()->rootFolder()));
    m_unreadStickyItem->setText(0, tr("Unread  (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
    m_unreadStickyItem->setData(0, Qt::DecorationRole, GuiIconProvider::instance()->getIcon("mail-folder-inbox"));

    connect(RSS::Session::instance()->rootFolder(), &RSS::Item::unreadCountChanged, this, &FeedListWidget::handleItemUnreadCountChanged);

    setSortingEnabled(false);
    fill(nullptr, RSS::Session::instance()->rootFolder());
    setSortingEnabled(true);

//    setCurrentItem(m_unreadStickyItem);
}
Exemplo n.º 7
0
// ****************************************************************************
//  Method:  SiloDirView::ChangeDir
//
//  Purpose:
//    Wrapper for "Set" which is suitable for a QTreeWidgetItem callback.
//
//  Programmer:  Jeremy Meredith
//  Creation:    November 12, 2001
//
//  Modifications:
//    Jeremy Meredith, Thu Nov 20 17:28:45 EST 2008
//    Ported to Qt4.
//
// ****************************************************************************
void
SiloDirView::ChangeDir(QTreeWidgetItem *i)
{
    SiloDirTreeViewItem *item = (SiloDirTreeViewItem*)i;
    headerItem()->setText(0, QString("Contents of ") + item->dir->path);
    Set(item->dir);
}
Exemplo n.º 8
0
QQuickItem *ItemListItem::itemAt(int index) const {
	if (index == HeaderItem)
		return headerItem();
	if (index == FooterItem)
		return footerItem();
	auto attached = d->list.value(index);
	return attached && attached->isQmlItem() ? attached->asItem() : nullptr;
}
Exemplo n.º 9
0
SoundLibraryTree::SoundLibraryTree( QWidget *pParent )
 : QTreeWidget( pParent )
{
	setHeaderLabels( QStringList( trUtf8( "Sound library" ) ) );
	setAlternatingRowColors(true);
	setRootIsDecorated( false );

	setItemHidden( headerItem(), true );	// hides the header

}
Exemplo n.º 10
0
UploadsList::UploadsList(QWidget *parent, const char *name)
 : QTreeWidget(parent)
{
    headerItem()->setText(0, tr("File Name"));
    headerItem()->setText(1, tr("Host"));
    headerItem()->setText(2, tr("Progress"));
    headerItem()->setText(3, tr("Status"));

    /* Set header resize modes and initial section sizes */
    QHeaderView * _uheader = header();
    _uheader->resizeSection ( 0, 200 );
    _uheader->resizeSection ( 1, 250 );
    _uheader->resizeSection ( 2, 160 );
    _uheader->resizeSection ( 3, 100 );

    setAlternatingRowColors(false);
    setSortingEnabled(true);
    setRootIsDecorated(false);
}
Exemplo n.º 11
0
void LastMultipleScoresList::addLineItem(const ItemArray &si,
                                         uint index, QTreeWidgetItem *line)
{
//   kDebug(11001) ;
    uint k = 1; // skip "id"
    for (int i=0; i<si.size()-2; i++) {
        if ( i==3 ) k = 5; // skip "date"
        const ItemContainer& container = *si[k];
        k++;
        if (line) {
	  line->setText(i, itemText(container, index));
	  line->setTextAlignment(i, container.item()->alignment());
	}
        else {
	    headerItem()->setText(i, container.item()->label() );
            headerItem()->setTextAlignment(i, container.item()->alignment());
        }
    }
}
Exemplo n.º 12
0
int LogbookTreeWidget::findColumnWithName(const std::string &name) {
	QTreeWidgetItem *item = headerItem();
	for (int i = 0; i < item->columnCount(); i++) {
		if (item->text(i).toStdString() == name) {
			return i;
		}
	}

	return -1;
}
Exemplo n.º 13
0
QVariantList QcTreeWidget::columns() const
{
  QVariantList varList;
  QTreeWidgetItem *header = headerItem();
  if( header ) {
    for( int i = 0; i < header->columnCount(); ++i ) {
      varList << header->text(i);
    }
  }
  return varList;
}
Exemplo n.º 14
0
void DownloadList::resizeEvent(QResizeEvent *event) {
	int nameCol = 0;
	QList<int> toResize;
	if (headerItem()->text(1) == "File Name") {
		nameCol = 1;
		toResize << 0 << 2 << 3 << 4;
	} else if (headerItem()->text(2) == "File Name") {
		nameCol = 2;
		toResize << 0 << 1 << 3 << 4;
	} else if (headerItem()->text(3) == "File Name") {
		nameCol = 3;
		toResize << 0 << 1 << 2 << 4;
	} else if (headerItem()->text(4) == "File Name") {
		nameCol = 4;
		toResize << 0 << 1 << 2 << 3;
	} else {
		toResize << 1 << 2 << 3 << 4;
	}
	foreach(int i, toResize) {
		header()->resizeSection(i, 100);
	}
Exemplo n.º 15
0
void ScoresList::addLineItem(const ItemArray &items,
                             uint index, QTreeWidgetItem *line)
{
//   kDebug(11001) ;
    uint k = 0;
    for (int i=0; i<items.size(); i++) {
        const ItemContainer& container = *items[i];
        if ( !container.item()->isVisible() ) {
	  continue;
	}
        if (line) {
	  line->setText(k, itemText(container, index));
	  line->setTextAlignment(k, container.item()->alignment());
	}
        else {
	    headerItem()->setText(k, container.item()->label() );
            headerItem()->setTextAlignment(k, container.item()->alignment());
        }
        k++;
    }
    update();
}
Exemplo n.º 16
0
FeedListWidget::FeedListWidget(QWidget *parent, const RssManagerPtr& rssmanager): QTreeWidget(parent), m_rssManager(rssmanager) {
  setContextMenuPolicy(Qt::CustomContextMenu);
  setDragDropMode(QAbstractItemView::InternalMove);
  setSelectionMode(QAbstractItemView::ExtendedSelection);
  setColumnCount(1);
  headerItem()->setText(0, tr("RSS feeds"));
  m_unreadStickyItem = new QTreeWidgetItem(this);
  m_unreadStickyItem->setText(0, tr("Unread") + QString::fromUtf8("  (") + QString::number(rssmanager->unreadCount(), 10)+ QString(")"));
  m_unreadStickyItem->setData(0,Qt::DecorationRole, IconProvider::instance()->getIcon("mail-folder-inbox"));
  itemAdded(m_unreadStickyItem, rssmanager);
  connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(updateCurrentFeed(QTreeWidgetItem*)));
  setCurrentItem(m_unreadStickyItem);
}
Exemplo n.º 17
0
void PlayerListWidget::retranslateUi()
{
	headerItem()->setText(0, QString());
	headerItem()->setText(1, QString());
	headerItem()->setText(2, QString());
	headerItem()->setText(3, QString());
	headerItem()->setText(4, tr("Player name"));
	headerItem()->setText(5, tr("Deck"));
}
Exemplo n.º 18
0
// ****************************************************************************
//  Constructor:  SiloDirView::SiloDirView
//
//  Programmer:  Jeremy Meredith
//  Creation:    November 12, 2001
//
//  Modifications:
//    Jeremy Meredith, Thu Nov 20 17:28:45 EST 2008
//    Ported to Qt4.
//
// ****************************************************************************
SiloDirView::SiloDirView(QWidget *p)
    : QTreeWidget(p)
{
    total_items = 0;

    mesh_pixmap   = new QPixmap(mesh_xpm);
    mat_pixmap    = new QPixmap(mat_xpm);
    var_pixmap    = new QPixmap(var_xpm);
    obj_pixmap    = new QPixmap(object_xpm);
    spec_pixmap   = new QPixmap(species_xpm);
    curve_pixmap  = new QPixmap(curve_xpm);
    array_pixmap  = new QPixmap(array_xpm);
    silovar_pixmap= new QPixmap(silovar_xpm);

    setColumnCount(1);
    headerItem()->setText(0,"Objects");
    setRootIsDecorated(true);
}
Exemplo n.º 19
0
FileBrowserTreeWidget::FileBrowserTreeWidget(QWidget * parent ) :
	QTreeWidget( parent ),
	m_mousePressed( false ),
	m_pressPos(),
	m_previewPlayHandle( NULL ),
	m_pphMutex( QMutex::Recursive ),
	m_contextMenuItem( NULL )
{
	setColumnCount( 1 );
	headerItem()->setHidden( true );
	setSortingEnabled( false );

	connect( this, SIGNAL( itemDoubleClicked( QTreeWidgetItem *, int ) ),
			SLOT( activateListItem( QTreeWidgetItem *, int ) ) );
	connect( this, SIGNAL( itemCollapsed( QTreeWidgetItem * ) ),
				SLOT( updateDirectory( QTreeWidgetItem * ) ) );
	connect( this, SIGNAL( itemExpanded( QTreeWidgetItem * ) ),
				SLOT( updateDirectory( QTreeWidgetItem * ) ) );

}
void toListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
{
#if 0                           // todo
    QPoint p = e->pos();
    int col = headerItem()->sectionAt(p.x());
    toTreeWidgetItem *item = itemAt(contentsToViewport(p));
    toResultViewItem *resItem = dynamic_cast<toResultViewItem *>(item);
    toResultViewCheck *chkItem = dynamic_cast<toResultViewCheck *>(item);
    QClipboard *clip = qApp->clipboard();
    if (resItem)
        clip->setText(resItem->allText(col));
    else if (chkItem)
        clip->setText(chkItem->allText(col));
    else if (item)
        clip->setText(item->text(col));

    Q3Header *head = header();
    for (int i = 0; i < columns(); i++)
    {
        QString str;
        if (resItem)
            str = resItem->allText(i);
        else if (chkItem)
            str = chkItem->allText(col);
        else if (item)
            str = item->text(i);

        try
        {
            toParamGet::setDefault(toCurrentConnection(this),
                                   head->label(i).lower(), toUnnull(str));
        }
        catch (...) {}
    }
    toTreeWidget::contentsMouseDoubleClickEvent(e);
#endif
}
Exemplo n.º 21
0
void KFLogTreeWidget::createShowColMenu()
{
  if( header()->count() == 0 || showColMenu != 0 )
    {
      return;
    }

  showColMenu = new QMenu(this);
  showColMenu->setTitle( tr("Toggle columns") );
  showColMenu->setToolTip(tr("Toggle visibility of table columns"));

  menuActionGroup = new QActionGroup(this);
  menuActionGroup->setExclusive( false );

  QAction *action = new QAction( tr("Show all columns"), this );
  action->setData( -1 );

  menuActionGroup->addAction( action );
  showColMenu->addAction( action );
  showColMenu->addSeparator();

  QTreeWidgetItem* hi = headerItem();

  for( int i = 0; i < header()->count(); i++ )
    {
      QAction *action = new QAction( hi->text(i), this );
      action->setCheckable( true );
      action->setChecked( isColumnHidden(i) == false );
      action->setData( i );

      menuActionGroup->addAction( action );
      showColMenu->addAction( action );
    }

  connect( menuActionGroup, SIGNAL(triggered(QAction *)),
           SLOT(slotMenuActionTriggered( QAction *)) );
}
Exemplo n.º 22
0
qm_plistview::qm_plistview(QWidget *parent)
{
    setParent(parent);

    if (objectName().isEmpty())
        setObjectName("plist_view");

    // initVars
    dropBeforeIndex = -1;
    line = new QWidget(viewport());
    line->hide();
    line->setAutoFillBackground(true);
    QPalette pal = line->palette();
    pal.setColor(line->backgroundRole(), QColor("#5f8ba9"));
    line->setPalette(pal);
    setDragDropMode(QAbstractItemView::DragDrop);
    setDropIndicatorShown(false);
    setDragEnabled(true);

    current_songPos = -1;
    current_songID = -1;
    current_status = 0;
    b_panel_max = false;
    b_streamplaying = false;
    b_waspurged = true;
    b_mpd_connected = false;
    col_default_fg = this->palette().color(QPalette::Foreground);
    col_played_fg  = QColor("#70707A");
    col_playing_fg = QColor("#003070");

    //setupUI
    setRootIsDecorated(false);
    setItemsExpandable (false);
    setUniformRowHeights(true);
    setAllColumnsShowFocus(true);
    setSelectionMode(ExtendedSelection);
    sortByColumn (-1); // no sorting
    setColumnCount(6);
    QStringList labels;
    labels << "#" << " " << " " + tr("artist") + " " << " " + tr("title") + " " << " " + tr("m:s") + " " << " " + tr("album : nr") + " ";
    setHeaderLabels(labels);
    headerItem()->setIcon(1, QIcon(":/tr_trackplayed.png"));
    QObject::connect( this, SIGNAL( itemDoubleClicked (QTreeWidgetItem *, int)), this, SLOT( on_item_dclicked(QTreeWidgetItem *)));

    context_menu = new QMenu();
    this->setContextMenuPolicy(Qt::DefaultContextMenu);

    a_clearlist = new QAction(context_menu);
    a_clearlist->setText(tr("Clear list"));
    a_clearlist->setIcon(QIcon(":/tr_redcross.png"));
    QObject::connect( a_clearlist, SIGNAL( triggered() ), this, SLOT( clear_it() ) );
    context_menu->addAction(a_clearlist);

    a_delsel = new QAction(context_menu);
    a_delsel->setText(tr("Remove selected"));
    a_delsel->setIcon(QIcon(":/tr_delete.png"));
    QObject::connect( a_delsel, SIGNAL( triggered() ), this, SLOT( delete_it() ) );
    context_menu->addAction(a_delsel);

    QAction *purge = new QAction(context_menu);
    purge->setText(tr("Purge played"));
    purge->setIcon(QIcon(":/tr_purge.png"));
    QObject::connect( purge, SIGNAL( triggered() ), this, SLOT( purge_it() ) );
    context_menu->addAction(purge);
    context_menu->addSeparator();

    a_playreset = new QAction(context_menu);
    a_playreset->setText(tr("Reset status"));
    a_playreset->setIcon(QIcon(":/tr_played_reset"));
    QObject::connect( a_playreset, SIGNAL( triggered() ), this, SLOT( reset_played() ) );
    context_menu->addAction(a_playreset);

    a_shuffle = new QAction(context_menu);
    a_shuffle->setText(tr("Shuffle list"));
    a_shuffle->setIcon(QIcon(":/tr_shuffle.png"));
    QObject::connect( a_shuffle, SIGNAL( triggered() ), this, SLOT( shuffle_it() ) );
    context_menu->addAction(a_shuffle);
    context_menu->addSeparator();

    a_savelist = new QAction(context_menu);
    a_savelist->setText(tr("Save list"));
    a_savelist->setIcon(QIcon(":/tr_save.png"));
    QObject::connect( a_savelist, SIGNAL( triggered() ), this, SLOT( save_it() ) );
    context_menu->addAction(a_savelist);

    a_savesel = new QAction(context_menu);
    a_savesel->setText(tr("Save selected"));
    a_savesel->setIcon(QIcon(":/tr_saveselect.png"));
    QObject::connect( a_savesel, SIGNAL( triggered() ), this, SLOT( save_selected() ) );
    context_menu->addAction(a_savesel);
/*    context_menu->addSeparator();

    a_loadlist = new QAction(context_menu);
    a_loadlist->setText(tr("Reload list"));
    a_loadlist->setIcon(QIcon(":/menu_load.png"));
    QObject::connect( a_loadlist, SIGNAL( triggered() ), this, SLOT( reload_playlist() ) );
    context_menu->addAction(a_loadlist); */
}
Exemplo n.º 23
0
TrackerList::TrackerList(PropertiesWidget *properties)
    : QTreeWidget()
    , m_properties(properties)
{
    // Set header
    // Must be set before calling loadSettings() otherwise the header is reset on restart
    setHeaderLabels(headerLabels());
    // Load settings
    loadSettings();
    // Graphical settings
    setRootIsDecorated(false);
    setAllColumnsShowFocus(true);
    setItemsExpandable(false);
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    header()->setStretchLastSection(false); // Must be set after loadSettings() in order to work
    // Ensure that at least one column is visible at all times
    if (visibleColumnsCount() == 0)
        setColumnHidden(COL_URL, false);
    // To also mitigate the above issue, we have to resize each column when
    // its size is 0, because explicitly 'showing' the column isn't enough
    // in the above scenario.
    for (unsigned int i = 0; i < COL_COUNT; ++i)
        if ((columnWidth(i) <= 0) && !isColumnHidden(i))
            resizeColumnToContents(i);
    // Context menu
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showTrackerListMenu(QPoint)));
    // Header context menu
    header()->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(header(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayToggleColumnsMenu(const QPoint&)));
    // Set DHT, PeX, LSD items
    m_DHTItem = new QTreeWidgetItem({ "",  "** [DHT] **", "", "0", "", "", "0" });
    insertTopLevelItem(0, m_DHTItem);
    setRowColor(0, QColor("grey"));
    m_PEXItem = new QTreeWidgetItem({ "",  "** [PeX] **", "", "0", "", "", "0" });
    insertTopLevelItem(1, m_PEXItem);
    setRowColor(1, QColor("grey"));
    m_LSDItem = new QTreeWidgetItem({ "",  "** [LSD] **", "", "0", "", "", "0" });
    insertTopLevelItem(2, m_LSDItem);
    setRowColor(2, QColor("grey"));
    // Set static items alignment
    m_DHTItem->setTextAlignment(COL_RECEIVED, (Qt::AlignRight | Qt::AlignVCenter));
    m_PEXItem->setTextAlignment(COL_RECEIVED, (Qt::AlignRight | Qt::AlignVCenter));
    m_LSDItem->setTextAlignment(COL_RECEIVED, (Qt::AlignRight | Qt::AlignVCenter));
    m_DHTItem->setTextAlignment(COL_SEEDS, (Qt::AlignRight | Qt::AlignVCenter));
    m_PEXItem->setTextAlignment(COL_SEEDS, (Qt::AlignRight | Qt::AlignVCenter));
    m_LSDItem->setTextAlignment(COL_SEEDS, (Qt::AlignRight | Qt::AlignVCenter));
    m_DHTItem->setTextAlignment(COL_PEERS, (Qt::AlignRight | Qt::AlignVCenter));
    m_PEXItem->setTextAlignment(COL_PEERS, (Qt::AlignRight | Qt::AlignVCenter));
    m_LSDItem->setTextAlignment(COL_PEERS, (Qt::AlignRight | Qt::AlignVCenter));
    m_DHTItem->setTextAlignment(COL_DOWNLOADED, (Qt::AlignRight | Qt::AlignVCenter));
    m_PEXItem->setTextAlignment(COL_DOWNLOADED, (Qt::AlignRight | Qt::AlignVCenter));
    m_LSDItem->setTextAlignment(COL_DOWNLOADED, (Qt::AlignRight | Qt::AlignVCenter));
    // Set header alignment
    headerItem()->setTextAlignment(COL_TIER, (Qt::AlignRight | Qt::AlignVCenter));
    headerItem()->setTextAlignment(COL_RECEIVED, (Qt::AlignRight | Qt::AlignVCenter));
    headerItem()->setTextAlignment(COL_SEEDS, (Qt::AlignRight | Qt::AlignVCenter));
    headerItem()->setTextAlignment(COL_PEERS, (Qt::AlignRight | Qt::AlignVCenter));
    headerItem()->setTextAlignment(COL_DOWNLOADED, (Qt::AlignRight | Qt::AlignVCenter));
    // Set hotkeys
    m_editHotkey = new QShortcut(Qt::Key_F2, this, SLOT(editSelectedTracker()), 0, Qt::WidgetShortcut);
    connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(editSelectedTracker()));
    m_deleteHotkey = new QShortcut(QKeySequence::Delete, this, SLOT(deleteSelectedTrackers()), 0, Qt::WidgetShortcut);
    m_copyHotkey = new QShortcut(QKeySequence::Copy, this, SLOT(copyTrackerUrl()), 0, Qt::WidgetShortcut);

    // This hack fixes reordering of first column with Qt5.
    // https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
    QTableView unused;
    unused.setVerticalHeader(header());
    header()->setParent(this);
    unused.setVerticalHeader(new QHeaderView(Qt::Horizontal));
}
Exemplo n.º 24
0
void InfoTreeWidget::showEvent(QShowEvent * e)
{
  // hack to fix a qdesigner bug
  headerItem()->setText(1,"");
  QTreeWidget::showEvent(e);
}
Exemplo n.º 25
0
akuTreeWidget::akuTreeWidget(QWidget *parent) : QTreeWidget(parent)
{
  setDragEnabled(false);
  setDragDropOverwriteMode(false);
  setDragDropMode(QAbstractItemView::NoDragDrop);
  setAlternatingRowColors(true);
  setSelectionMode(QAbstractItemView::ExtendedSelection);
  setAutoExpandDelay(-1);
  setRootIsDecorated(true);
  setUniformRowHeights(false);
  setSortingEnabled(true);
  setAnimated(true);
  setAllColumnsShowFocus(true);
  headerItem()->setText(0, i18n("File Name", 0));
  headerItem()->setText(1, i18n("Size", 0));
  headerItem()->setText(2, i18n("Packed Size", 0));
  headerItem()->setText(3, i18n("Ratio", 0));
  headerItem()->setText(4, i18n("Modified", 0));
  headerItem()->setText(5, i18n("Attributes", 0));
  headerItem()->setText(6, i18n("CRC", 0));
  headerItem()->setText(7, i18n("Method", 0));
  headerItem()->setText(8, i18n("Version", 0));
  headerItem()->setText(9, i18n("MIME Type", 0));
  headerItem()->setText(10,"");
  headerItem()->setIcon(10,KIcon("document-properties"));
  headerItem()->setToolTip(10, i18n("Status: a key is shown if the file is crypted"));
  header() -> moveSection(10,0);
  header() -> setResizeMode(10,QHeaderView::ResizeToContents);
  header() -> setResizeMode(4,QHeaderView::ResizeToContents);
  setupActions();
}
Exemplo n.º 26
0
QSceneTreeWidget::QSceneTreeWidget(QWidget* pParent /*= 0*/)
  : QTreeWidget(pParent)
{
  headerItem()->setText(0, "id");
  headerItem()->setText(1, "class");
}