/**
 * @brief Creates an empty strings tree view.
 * @param parent The parent object or nullptr.
 */
StringsTreeView::StringsTreeView(QWidget* parent) :
  QTreeView(parent),
  model(nullptr) {

  setSelectionMode(QAbstractItemView::SingleSelection);
  setAlternatingRowColors(true);

  create_action = new QAction(
        QIcon(":/images/icon_add.png"), tr("New string..."), this);
  connect(create_action, SIGNAL(triggered()),
          this, SIGNAL(create_string_requested()));
  addAction(create_action);

  duplicate_action = new QAction(
        QIcon(":/images/icon_copy.png"), tr("Duplicate string(s)..."), this);
  connect(duplicate_action, SIGNAL(triggered()),
          this, SIGNAL(duplicate_string_requested()));
  addAction(duplicate_action);

  set_key_action = new QAction(
        QIcon(":/images/icon_rename.png"), tr("Change key..."), this);
  set_key_action->setShortcut(tr("F2"));
  set_key_action->setShortcutContext(Qt::WidgetShortcut);
  connect(set_key_action, SIGNAL(triggered()),
          this, SIGNAL(set_string_key_requested()));
  addAction(set_key_action);

  delete_action = new QAction(
        QIcon(":/images/icon_delete.png"), tr("Delete..."), this);
  delete_action->setShortcut(QKeySequence::Delete);
  delete_action->setShortcutContext(Qt::WidgetShortcut);
  connect(delete_action, SIGNAL(triggered()),
          this, SIGNAL(delete_string_requested()));
  addAction(delete_action);
}
Esempio n. 2
0
void ProcessView::updateView()
{
    setAlternatingRowColors(true);
    resizeColumnToContents(0);
    setColumnWidth(1, 50);
    setColumnWidth(2, 50);
}
Esempio n. 3
0
DatabaseView::DatabaseView(QWidget *parent) :
    QTableView(parent)
{
    setContextMenuPolicy(Qt::ActionsContextMenu);
    setAlternatingRowColors( true );
    setEditTriggers( QAbstractItemView::DoubleClicked
                     | QAbstractItemView::EditKeyPressed );

    QAction* editTagsAction = new QAction( this );
    addAction( editTagsAction );
    editTagsAction->setText(tr("Edit Tags"));
    editTagsAction->setShortcut(QKeySequence("Ctrl+T"));
    editTagsAction->setIcon(QIcon(":/oldIcons/oldIcons/tag-2.png"));
    connect(editTagsAction, &QAction::triggered, [this]()
    {
        QModelIndexList list = selectionModel()->selectedIndexes();
        if (!list.isEmpty())
        {
            Taggable* t = objectAt(list.first());
            if (t != 0)
            {
                TagDialog d(t->tags(), this);
                if (d.exec() == QDialog::Accepted)
                {
                    app().pushCommand( new EditTagsCommand( t, d.tags() ) );
                }
            }
        }

    });
}
Esempio n. 4
0
XTreeView::XTreeView(QWidget *parent) : 
  QTreeView(parent)
{
  _keyColumns        = 1;
  _resizingInProcess = false;
  _settingsLoaded    = false;
  _forgetful         = false;
  _ignoreSizing      = false;

  _menu = new QMenu(this);
  _menu->setObjectName("_menu");

  setContextMenuPolicy(Qt::CustomContextMenu);
  header()->setStretchLastSection(false);
  header()->setClickable(true);
  header()->setContextMenuPolicy(Qt::CustomContextMenu);

  if (_x_preferences)
    setAlternatingRowColors(!_x_preferences->boolean("NoAlternatingRowColors"));

  _mapper = new XDataWidgetMapper(this);
  _model = new XSqlTableModel(this);
  _model->setEditStrategy(QSqlTableModel::OnManualSubmit);
  
  connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(sShowMenu(const QPoint &)));
  connect(header(), SIGNAL(customContextMenuRequested(const QPoint &)),
                    SLOT(sShowHeaderMenu(const QPoint &)));
  connect(header(), SIGNAL(sectionResized(int, int, int)),
          this,     SLOT(sColumnSizeChanged(int, int, int)));
  connect(_model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(handleDataChanged(const QModelIndex, const QModelIndex)));
  _windowName = window()->objectName();
}
Esempio n. 5
0
views::treeView::treeView(QWidget *parent,QString name)
        :QTreeView(parent),_ratingColumn(-1),_playOnDoubleCl(true)
{
    setHeader(new treeViewHeader(this));
    setUniformRowHeights(true);
    setAlternatingRowColors(false);
    
    delegate=new treeViewDelegate(this);
    setItemDelegate(delegate);

    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setSelectionBehavior(QAbstractItemView::SelectRows);

    setDragEnabled(true);
    setDragDropMode( QAbstractItemView::DragDrop );
    setRootIsDecorated(false);
    setSortingEnabled (true);

    setMouseTracking(true);

    if (!name.isEmpty() )
    {
        setObjectName(name);
        readSettings();
    }
    setEditTriggers(QAbstractItemView::SelectedClicked);
	
	setExpandsOnDoubleClick(false);
	connect(this, SIGNAL(clicked(const QModelIndex &)), this, SLOT(itemClicked(const QModelIndex &)) );
}
Esempio n. 6
0
pTableWidget::pTableWidget(QWidget *parent) :
    QTableWidget(parent),
    m_defaultSortedColumn(0)
{
    setSortingEnabled(true);

    QHeaderView *header;

    // Horizontal header
    header = horizontalHeader();
    header->setHighlightSections(false);
    header->setSortIndicatorShown(false);
    header->setDefaultSectionSize(50);
    header->show();

    // Vertical header
    header = verticalHeader();
    header->setDefaultSectionSize(21);
    header->hide();

    // Frame
    //setFrameStyle(QFrame::NoFrame);

    setSelectionMode(QAbstractItemView::SingleSelection);
    setSelectionBehavior(QAbstractItemView::SelectRows);
    setEditTriggers(QAbstractItemView::NoEditTriggers);

    setAlternatingRowColors(true);

    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));

    connect(horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(updateToolButtonNumber()));
}
Esempio n. 7
0
XTableView::XTableView(QWidget *parent) : 
  QTableView(parent)
{
  _keyColumns        = 1;
  _resizingInProcess = false;
  _settingsLoaded    = false;
  _forgetful         = false;

  _menu = new QMenu(this);
  _menu->setObjectName("_menu");

  setContextMenuPolicy(Qt::CustomContextMenu);
  verticalHeader()->setDefaultSectionSize(20);
  horizontalHeader()->setStretchLastSection(false);
  horizontalHeader()->setClickable(true);
  horizontalHeader()->setContextMenuPolicy(Qt::CustomContextMenu); 

  setAlternatingRowColors(true);
  QPalette muted = palette();
  muted.setColor(QPalette::AlternateBase, QColor(0xEE, 0xEE, 0xEE));
  setPalette(muted);

  _mapper = new XDataWidgetMapper(this);
  _model = new XSqlTableModel(this);
  _model->setEditStrategy(QSqlTableModel::OnManualSubmit);
  
  connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(sShowMenu(const QPoint &)));
  connect(horizontalHeader(), SIGNAL(customContextMenuRequested(const QPoint &)),
                    SLOT(sShowHeaderMenu(const QPoint &)));
  connect(horizontalHeader(), SIGNAL(sectionResized(int, int, int)),
          this,     SLOT(sColumnSizeChanged(int, int, int)));
  connect(_model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(handleDataChanged(const QModelIndex, const QModelIndex)));
  _windowName = window()->objectName();
}
caTable::caTable(QWidget *parent) : QTableWidget(parent)

{
    setPrecisionMode(Channel);
    setLimitsMode(Channel);
    setPrecision(0);
    setMinValue(0.0);
    setMaxValue(1.0);
    for(int i=0; i< MaxRows; i++) {
        setFormat(i, 1);
        for(int j=0; j< MaxCols; j++) tableItem[i][j] = (QTableWidgetItem*) 0;
    }

    thisItemFont = this->font();

    setColorMode(Static);
    setAlternatingRowColors(true);
    setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
    setEditTriggers(QTableWidget::NoEditTriggers);
    verticalHeader()->setDefaultSectionSize(20);
    horizontalHeader()->setResizeMode(QHeaderView::Stretch);

    defaultForeColor = palette().foreground().color();

    createActions();
    addAction(copyAct);

    connect(this, SIGNAL( cellDoubleClicked (int, int) ), this, SLOT(celldoubleclicked( int, int ) ) );
    //connect(this, SIGNAL( cellClicked (int, int) ), this, SLOT(cellclicked( int, int ) ) );
}
Esempio n. 9
0
void PropertyBrowser::initView()
{
    setEditTriggers(QAbstractItemView::AllEditTriggers);
    setAlternatingRowColors(true);
    setUniformRowHeights(true);
    setTabKeyNavigation(true);
}
ObjectInspectorTable::ObjectInspectorTable(Map *map)
    : m_map(map), m_graphicsObjectEditor(0)
{

    QStringList tableHeadersLabel;
    tableHeadersLabel << "Nom" << "Type";
    setColumnCount(2);
    setHeaderLabels(tableHeadersLabel);

    setAlternatingRowColors(true);

    setAnimated(true);

    setSelectionMode(QAbstractItemView::ExtendedSelection);

    clear();
    addDefaultLayout();

    connect(this, SIGNAL(itemSelectionChanged()), SLOT(selectionUpdated()));
    connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), SLOT(itemWasDoubleClicked(QTreeWidgetItem*,int)));

    // connexion pour gérer les layouts
    connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)), SLOT(LayoutItemModified(QTreeWidgetItem*,int)));

    setDragDropMode(QAbstractItemView::DragDrop);
}
Esempio n. 11
0
  EngineListView::EngineListView( GLWidget *glWidget, QWidget *parent ) : QListView(parent), d(new EngineListViewPrivate)
  {
    d->glWidget = glWidget;

    EngineItemModel *m = new EngineItemModel(d->glWidget, this);

    if(model())
    {
      delete model();
    }

		// This should sort the engine names for user views
		// It should also update dynamically as people edit names
		// Somehow it doesn't work right from the start!
		QSortFilterProxyModel *sortModel = new QSortFilterProxyModel(this);
		sortModel->setSourceModel(m);
    setModel(sortModel);
		sortModel->setSortCaseSensitivity(Qt::CaseInsensitive);
		sortModel->setSortLocaleAware(true);
		sortModel->setDynamicSortFilter(true);
		sortModel->sort(0, Qt::AscendingOrder);
		
    connect(this, SIGNAL(clicked(QModelIndex)),
        this, SLOT(selectEngine(QModelIndex)));
		// This might work for having the proxy model emit the signal, but let's keep it as-is
    connect(m, SIGNAL(dataChanged(QModelIndex, QModelIndex)),
        glWidget, SLOT(update()));
        
    // improves display performance
    setUniformItemSizes(true);
    setAlternatingRowColors(true); // looks better
  }
Esempio n. 12
0
SubtitleComponentView::SubtitleComponentView(QWidget *parent)
: QTreeView(parent), d(new Data) {
	d->model = 0;
	d->autoScroll = false;
	setAlternatingRowColors(true);
	setRootIsDecorated(false);
}
Esempio n. 13
0
FooPlaylistWidget::FooPlaylistWidget(const QString& name, const QUuid& uuid, QWidget *parent) : QTreeView(parent)
{
	playlistName = name;
	playlistUuid = uuid;

	setSelectionMode(QAbstractItemView::ExtendedSelection);
	setSelectionBehavior(QAbstractItemView::SelectRows);
	setSortingEnabled(false);
	setIndentation(0);
	setAlternatingRowColors(true);
	// For drag and drop files, QAbstractItemView::DragDrop doesn't work (why?)
	setAcceptDrops(true);
	setDragDropMode(QAbstractItemView::InternalMove);
	setDragEnabled(true);
	viewport()->setAcceptDrops(true);
	setDropIndicatorShown(true);
	// Context Menu
	setContextMenuPolicy(Qt::CustomContextMenu);
	setItemsExpandable(false);
	setRootIsDecorated(false);

	connect(this, SIGNAL (customContextMenuRequested (const QPoint &)), this, SLOT (contextMenuRequested (const QPoint &)));

// 	QStringList l;
// 	l << tr("File");
// 	setHeaderLabels(l);
//
// 	// TODO Remove and add something normal
// 	Filters << ".mp3"  << ".wma" << ".mp4" << ".mpg" << ".mpeg" << ".m4a";
// 	Filters << ".flac" << ".ogg" << ".wav" << ".3gp" << ".ac3" << ".aac";

	// TODO .m3u .m4u
}
QgsLocatorOptionsWidget::QgsLocatorOptionsWidget( QgsLocatorWidget *locator, QWidget *parent )
  : QTreeView( parent )
  , mLocatorWidget( locator )
  , mLocator( locator->locator() )
{

  mModel = new QgsLocatorFiltersModel( mLocator, this );
  setModel( mModel );

  header()->setStretchLastSection( false );
  header()->setSectionResizeMode( QgsLocatorFiltersModel::Name, QHeaderView::Stretch );

  setEditTriggers( QAbstractItemView::AllEditTriggers );
  setAlternatingRowColors( true );
  setSelectionMode( QAbstractItemView::NoSelection );

  // add the config button
  for ( int row = 0; row < mModel->rowCount(); ++row )
  {
    QModelIndex index = mModel->index( row, QgsLocatorFiltersModel::Config );
    QWidget *bt = mModel->configButton( index, this );
    if ( bt )
    {
      setIndexWidget( index, bt );
    }
  }
}
Esempio n. 15
0
MyListWidget::MyListWidget(QWidget* parent) :
        QListWidget(parent) {

    m_hoveredIndex =QPersistentModelIndex();
    m_showHotkey=false;
    m_arrowHover= false;

    setAttribute(Qt::WA_AlwaysShowToolTips);
    setAlternatingRowColors(true);
    setAutoScroll(true);
    QRect r = geometry();

    setAutoScrollMargin(r.height()/3);

    connect(this,
            SIGNAL(listItemAction(QString , CatItem )),
            (QObject*)gMainWidget, //
            SLOT(operateOnItem(QString , CatItem )));

    connect(this, SIGNAL(showOptionsMenu(QString, QPoint)),
            (QObject*)gMainWidget, SLOT(listMenuEvent(QString, QPoint)),
            Qt::QueuedConnection);

    setMouseTracking(true);
    m_hoveStart = QTime::currentTime();
    m_hovered= false;
}
Esempio n. 16
0
KNMusicStoreAlbumTreeView::KNMusicStoreAlbumTreeView(QWidget *parent) :
    QTreeView(parent),
    m_mouseAnime(new QTimeLine(200, this))
{
    //Set properties.
    setAllColumnsShowFocus(true);
    setAlternatingRowColors(false); //We will use our own alternating drawing.
    setContentsMargins(0, 0, 0, 0);
    setFrameShape(QFrame::NoFrame);
    setIndentation(0);
    setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
    setSelectionBehavior(QAbstractItemView::SelectRows);
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setUniformRowHeights(true);
    setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);

    //Configure the time line.
    m_mouseAnime->setEasingCurve(QEasingCurve::OutCubic);
    m_mouseAnime->setUpdateInterval(10);
    //Link the time line.
    connect(m_mouseAnime, &QTimeLine::frameChanged,
            this, &KNMusicStoreAlbumTreeView::onActionMouseInOut);

    //Initial the sense header.
    KNMouseSenseHeader *header=new KNMouseSenseHeader(this);
    header->setSectionsMovable(false);
    header->setSectionsClickable(false);
    header->setFixedHeight(38);
    setHeader(header);

    //Link with theme manager.
    connect(knTheme, &KNThemeManager::themeChange,
            this, &KNMusicStoreAlbumTreeView::onActionThemeUpdate);
}
CMSCoffeeUserTableView::CMSCoffeeUserTableView(CMSCoffeeUserModel* model,
                                               QWidget *parent) :
    QTableView(parent),
    userModel_(model)
{
    setModel(userModel_);
    setAlternatingRowColors(true);
    setMinimumWidth(450);
    setMinimumHeight(400);

    setColumnWidth(0, 300);
    setColumnWidth(1, 50);
    setColumnWidth(2, 90);
    setColumnWidth(3, 90);

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
    horizontalHeader()->setResizeMode(1, QHeaderView::Fixed);
    horizontalHeader()->setResizeMode(2, QHeaderView::Fixed);
    horizontalHeader()->setResizeMode(3, QHeaderView::Fixed);
#else
    horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
    horizontalHeader()->setSectionResizeMode(1, QHeaderView::Fixed);
    horizontalHeader()->setSectionResizeMode(2, QHeaderView::Fixed);
    horizontalHeader()->setSectionResizeMode(3, QHeaderView::Fixed);
#endif

    setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
}
DbTable::DbTable(list<ColumnConfig> cc,const litesql::Expr & expr,Wt::WContainerWidget * parent):
    Wt::Ext::TableView(parent),
    _column_config(cc),
    _sql(sql) {
    setBorder(false);
    model=new DbTableModel(cc,expr,parent);
    setModel(model);
    setAlternatingRowColors(true);
    resizeColumnsToContents(true);
    setHighlightMouseOver(true);
    setSelectionBehavior(Wt::SelectRows);
    setSelectionMode(Wt::SingleSelection);
    std::list<ColumnConfig>::iterator confit=cc.begin();
    for(int a=0; confit!=cc.end(); confit++, a++) {
//          enableColumnHiding(a, true);
//          setColumnSortable(a, true);
        setColumnWidth(a,(*confit).getWidth());
    }
    _clickCount=0;
    cellClicked().connect(SLOT(this,DbTable::itemSelected));
    doubleClickTimer=new Wt::WTimer(this);
    doubleClickTimer->setInterval(200);
    doubleClickTimer->timeout().connect(SLOT(this, DbTable::emitClickCount));

}
Esempio n. 19
0
JobStatWidget::JobStatWidget( QWidget * parent )
: QTreeWidget( parent )
{
	setAlternatingRowColors(true);
	setHeaderLabels( QStringList() << "Statistic" << "Value" );
	setRootIsDecorated( false );
}
Esempio n. 20
0
MenuBarTree::MenuBarTree(TFilePath & path, QWidget* parent)
	: QTreeWidget(parent)
	, m_path(path)
{
	setObjectName("SolidLineFrame");
	setAlternatingRowColors(true);
	setDragEnabled(true);
	setDropIndicatorShown(true);
	setDefaultDropAction(Qt::MoveAction);
	setDragDropMode(QAbstractItemView::DragDrop);

	setColumnCount(1);
	header()->close();

	/*- m_pathが存在するならファイルから読み込む。無ければテンプレートを読み込む -*/
	TFilePath fp;
	if (TFileStatus(path).isWritable())
		fp = m_path;
	else
	{
		fp = m_path.withParentDir(ToonzFolder::getTemplateModuleDir());
		if (!TFileStatus(path).isReadable())
			fp = ToonzFolder::getTemplateModuleDir() + "menubar_template.xml";
	}

	loadMenuTree(fp);
}
Esempio n. 21
0
AdvancedSettings::AdvancedSettings(QWidget *parent)
    : QTableWidget(parent)
{
    // column
    setColumnCount(COL_COUNT);
    QStringList header = {tr("Setting"), tr("Value", "Value set for this setting")};
    setHorizontalHeaderLabels(header);
    // row
    setRowCount(ROW_COUNT);
    verticalHeader()->setVisible(false);
    // etc.
    setAlternatingRowColors(true);
    setSelectionMode(QAbstractItemView::NoSelection);
    setEditTriggers(QAbstractItemView::NoEditTriggers);
    // Signals
    connect(&spinBoxCache, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
            , this, &AdvancedSettings::updateCacheSpinSuffix);
    connect(&comboBoxInterface, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
            , this, &AdvancedSettings::updateInterfaceAddressCombo);
    connect(&spinBoxSaveResumeDataInterval, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
            , this, &AdvancedSettings::updateSaveResumeDataIntervalSuffix);
    // Load settings
    loadAdvancedSettings();
    resizeColumnToContents(0);
    horizontalHeader()->setStretchLastSection(true);
}
Esempio n. 22
0
void ChannelListWidget::readSettings()
{
    Settings *s = qApp->settings();
    s->beginGroup("ChannelListWidget");
        header()->restoreState(s->value("HeaderState").toByteArray());
        setIconSize(s->value("IconSize").toSize());
        setAlternatingRowColors(s->value("AlternatingRowColors").toBool());
        if (alternatingRowColors())
            setStyleSheet(QString("QTreeWidget { alternate-background-color: %1; }")
                    .arg(s->value("AlternateBackgroundColor").toString()));
        m_customToolTip = s->value("CustomToolTip").toBool();

        m_linkType = (LinkType)s->value("LinkType").toInt();
        m_linkEnabled = s->value("LinkEnabled").toBool();
        m_linkColor = s->value("LinkColor",
                style()->standardPalette().link().color()).value<QColor>();
        m_linkBold = s->value("LinkBold").toBool();
        m_linkUnderline = s->value("LinkUnderline").toBool();
        m_linkStatusTipFormats[ChannelLink] = s->value("ChannelLinkStatusTipFormat",
                tr("$CHANNEL(NAME) | ビットレート $CHANNEL(BITRATE)kbps | "
                "視聴者 $CHANNEL(LISTENERS_STRING) | 配信時間 $CHANNEL(UPTIME_STRING) | "
                "種類 $CHANNEL(TYPE)")).toString();
        m_linkStatusTipFormats[ContactLink] = s->value("ContactLinkStatusTipFormat",
                tr("$CHANNEL(CONTACT_URL)")).toString();

        m_minimumItemHeight = s->value("MinimumItemHeight").toInt();

        m_sortOrder.clear();
        foreach (QVariant var, s->value("SortOrder").toList())
            m_sortOrder += var.toInt();
        if (m_sortOrder.isEmpty())
            m_sortOrder << Status << Uptime << Listeners << Name;
    s->endGroup();
}
/*! Create a new scenario view widget.
 */
ScenarioTree::ScenarioTree(QWidget *parent)
    : QTreeWidget(parent)
{
    QStringList labels;
    labels << tr("Type") << tr("Name");
    
    //header()->setResizeMode(QHeaderView::ResizeToContents);
    header()->setResizeMode(QHeaderView::Interactive);
    header()->setDefaultSectionSize(200);
    header()->setCascadingSectionResizes(true);

    setHeaderLabels(labels);
    
    m_folderIcon.addPixmap(style()->standardPixmap(QStyle::SP_DirClosedIcon),
                           QIcon::Normal, QIcon::Off);
    m_folderIcon.addPixmap(style()->standardPixmap(QStyle::SP_DirOpenIcon),
                           QIcon::Normal, QIcon::On);
    m_scenarioElementIcon.addPixmap(style()->standardPixmap(QStyle::SP_FileIcon));
    
    connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
            this, SLOT(editItem(QTreeWidgetItem*, int)));
    connect(this, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
            this, SLOT(editItemInline(QTreeWidgetItem*, int)));
    setExpandsOnDoubleClick(false);
    
    // Set drag and drop behavior
    setDragEnabled(true);
    setAcceptDrops(true);
    setDragDropMode(QAbstractItemView::DragDrop);
    setDropIndicatorShown(true);

    setAlternatingRowColors(true);


}
Esempio n. 24
0
FilmsViewList::FilmsViewList( QWidget* parent ) : QTableView( parent )
{
      // Appearance
    setAlternatingRowColors( true );
    setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );
    setSelectionBehavior( QAbstractItemView::SelectRows );
    setSelectionMode( QAbstractItemView::ExtendedSelection );
    setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
    setEditTriggers( QAbstractItemView::NoEditTriggers );
    setContextMenuPolicy( Qt::CustomContextMenu );
    setSortingEnabled( true );
    setShowGrid( false );

    verticalHeader()->setVisible( false );
    horizontalHeader()->setSectionsMovable( true );
    horizontalHeader()->setHighlightSections( false );
    horizontalHeader()->setStretchLastSection( true );
    horizontalHeader()->setDefaultSectionSize( 50 );
    horizontalHeader()->setMinimumSectionSize( 20 );
    horizontalHeader()->setContextMenuPolicy( Qt::CustomContextMenu );

      // Signals
    connect( horizontalHeader(), &QHeaderView::customContextMenuRequested, this, &FilmsViewList::ShowHeaderContextMenu );

    connect( this, SIGNAL(activated(QModelIndex)), this, SIGNAL(CurrentActivated(QModelIndex)) );

    connect( this, &QTableView::customContextMenuRequested, this, [this] (const QPoint& pos)
    {
        if( currentIndex().isValid() )
        {
            emit ContextMenuRequested( pos, selectionModel()->currentIndex() );
        }
    });
}
Esempio n. 25
0
// wrapper class to extract info from QTableWidget regarding sorting and
// position of each label in the header
MailListView::MailListView(QWidget *parent, const char *name)
    : QTableWidget( parent)
{
    setObjectName( name );
    setFrameStyle( NoFrame );
    connect(horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(sizeChange(int,int,int)) );
    horizontalHeader()->setSortIndicatorShown(false);

    sortColumn = -1;
    ascending = false;
    emailsOnly = false;

    connect( &menuTimer, SIGNAL(timeout()), SLOT(itemMenuRequested()) );
    connect( this, SIGNAL(itemSelectionChanged()), SLOT(cancelMenuTimer()) );
    connect( horizontalScrollBar(), SIGNAL(valueChanged(int)),
             this, SLOT(scrollToLeft(int)) );

    arrival = false;

    hVisible = true;    //part of sizeChangefix (avoid unnecessary flickering)
    maxColumnWidth = 0;
    mSingleColumnMode = true;
    QSoftMenuBar::setLabel(this, Qt::Key_Select, QSoftMenuBar::NoLabel);
    columns << "";
    if(!mSingleColumnMode)
    {
        columns << tr( "From" );
        columns <<  tr( "Subject" );
        columns <<  tr( "Date" );
    }
    setColumnCount( columns.count() );
    setHorizontalHeaderLabels( columns );
    verticalHeader()->hide();

    // Row height should be the size of the text - the second line being 3/4ths of the first
    int textHeight = QFontMetrics(font()).height() * 7 / 4;

    // Also, the icon could be larger than the text
    int iconHeight = style()->pixelMetric(QStyle::PM_ListViewIconSize);
    verticalHeader()->setDefaultSectionSize( qMax(textHeight, iconHeight) );

    setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    setAlternatingRowColors( true );

    horizontalHeaderItem(0)->setIcon(QPixmap(":image/flag"));

    QAction *hhWhatsThis = QWhatsThis::createAction( horizontalHeader() );
    hhWhatsThis->setText( tr("Select the sort order by tapping any of the columns in this header.  Tapping the same column twice will switch between ascending and descending order.") );

    QAction *tWhatsThis = QWhatsThis::createAction( this );
    tWhatsThis->setText( tr("A list of the messages in your current folder.  Tap a message to examine it.") );

//    setRootIsDecorated( true );

    setSelectionMode( QAbstractItemView::ExtendedSelection );
    EmailListItemDelegate *delegate = new EmailListItemDelegate( this );
    setItemDelegate( delegate );
    scrollToLeft( 0 );
    horizontalHeader()->setResizeMode(QHeaderView::Stretch);
}
Esempio n. 26
0
QtTreeWidget::QtTreeWidget(UIEventStream* eventStream, SettingsProvider* settings, MessageTarget messageTarget, QWidget* parent) : QTreeView(parent),  eventStream_(eventStream), settings_(settings), messageTarget_(messageTarget) {
    model_ = new RosterModel(this, settings_->getSetting(QtUISettingConstants::USE_SCREENREADER));
    setModel(model_);
    delegate_ = new RosterDelegate(this, settings_->getSetting(QtUISettingConstants::COMPACT_ROSTER));
    setItemDelegate(delegate_);
    setHeaderHidden(true);
#ifdef SWIFT_PLATFORM_MACOSX
    setAlternatingRowColors(true);
#endif
    setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    expandAll();
    setAnimated(true);
    setIndentation(0);
#ifdef SWIFT_EXPERIMENTAL_FT
    setAcceptDrops(true);
#endif
    setDragEnabled(true);
    setRootIsDecorated(true);
    connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(handleItemActivated(const QModelIndex&)));
    connect(model_, SIGNAL(itemExpanded(const QModelIndex&, bool)), this, SLOT(handleModelItemExpanded(const QModelIndex&, bool)));
    connect(this, SIGNAL(expanded(const QModelIndex&)), this, SLOT(handleExpanded(const QModelIndex&)));
    connect(this, SIGNAL(collapsed(const QModelIndex&)), this, SLOT(handleCollapsed(const QModelIndex&)));
    connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(handleClicked(const QModelIndex&)));

    settings_->onSettingChanged.connect(boost::bind(&QtTreeWidget::handleSettingChanged, this, _1));

    QFont lato = font();
    lato.setFamily("Lato");
    setFont(lato);
}
Esempio n. 27
0
EntryView::EntryView(QWidget* parent)
    : QTreeView(parent)
    , m_model(new EntryModel(this))
    , m_sortModel(new SortFilterHideProxyModel(this))
    , m_inEntryListMode(false)
{
    m_sortModel->setSourceModel(m_model);
    m_sortModel->setDynamicSortFilter(true);
    m_sortModel->setSortLocaleAware(true);
    m_sortModel->setSortCaseSensitivity(Qt::CaseInsensitive);
    m_sortModel->setSupportedDragActions(m_model->supportedDragActions());
    QTreeView::setModel(m_sortModel);

    setUniformRowHeights(true);
    setRootIsDecorated(false);
    setAlternatingRowColors(true);
    setDragEnabled(true);
    setSortingEnabled(true);
    setSelectionMode(QAbstractItemView::ExtendedSelection);

    // QAbstractItemView::startDrag() uses this property as the default drag action
    setDefaultDropAction(Qt::MoveAction);

    connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
    connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(entrySelectionChanged()));
    connect(m_model, SIGNAL(switchedToEntryListMode()), SLOT(switchToEntryListMode()));
    connect(m_model, SIGNAL(switchedToGroupMode()), SLOT(switchToGroupMode()));
}
Esempio n. 28
0
PlTreeView::PlTreeView( QAbstractItemModel *, QWidget *parent ) : QTreeView( parent )
{
    setItemDelegate( new PlTreeViewItemDelegate( this ) );
    setItemDelegateForColumn( VLCModel::metaToColumn(COLUMN_COVER),
                              new CellPixmapDelegate( this ) );
    setIconSize( QSize( 20, 20 ) );
    setAlternatingRowColors( true );
    setAnimated( true );
    setUniformRowHeights( true );
    setSortingEnabled( true );
    setAttribute( Qt::WA_MacShowFocusRect, false );
    viewport()->setAttribute( Qt::WA_Hover );
    header()->setSortIndicator( -1 , Qt::AscendingOrder );
    header()->setSortIndicatorShown( true );
#if HAS_QT5
    header()->setSectionsClickable( true );
#else
    header()->setClickable( true );
#endif
    header()->setContextMenuPolicy( Qt::CustomContextMenu );

    setSelectionBehavior( QAbstractItemView::SelectRows );
    setSelectionMode( QAbstractItemView::ExtendedSelection );
    setDragEnabled( true );
    setAcceptDrops( true );
    setDropIndicatorShown( true );
    setContextMenuPolicy( Qt::CustomContextMenu );
}
Esempio n. 29
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();
}
Esempio n. 30
0
KateCompletionTree::KateCompletionTree(KateCompletionWidget *parent)
    : ExpandingTree(parent)
{
    m_scrollingEnabled = true;
    header()->hide();
    setRootIsDecorated(false);
    setIndentation(0);
    setFrameStyle(QFrame::NoFrame);
    setAllColumnsShowFocus(true);
    setAlternatingRowColors(true);
    //We need ScrollPerItem, because ScrollPerPixel is too slow with a very large competion-list(see KDevelop).
    setVerticalScrollMode(QAbstractItemView::ScrollPerItem);

    m_resizeTimer = new QTimer(this);
    m_resizeTimer->setSingleShot(true);

    connect(m_resizeTimer, SIGNAL(timeout()), this, SLOT(resizeColumnsSlot()));

    // Provide custom highlighting to completion entries
    setItemDelegate(new KateCompletionDelegate(widget()->model(), widget()));
    // make sure we adapt to size changes when the model got reset
    // this is important for delayed creation of groups, without this
    // the first column would never get resized to the correct size
    connect(widget()->model(), &QAbstractItemModel::modelReset,
            this, &KateCompletionTree::scheduleUpdate);

    // Prevent user from expanding / collapsing with the mouse
    setItemsExpandable(false);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}