Beispiel #1
0
CheckDirTree::CheckDirTree( QWidget* parent )
    : QTreeView( parent )
{
    m_dirModel.setFilter( QDir::Dirs | QDir::NoDotAndDotDot );
    m_dirModel.setRootPath( "/" );

    m_dirModel.setNameFilters( QStringList() << "[^\\.]*" );

    setModel( &m_dirModel );
    setColumnHidden( 1, true );
    setColumnHidden( 2, true );
    setColumnHidden( 3, true );
    //header()->hide();

    connect( &m_dirModel, SIGNAL( dataChangedByUser( QModelIndex ) ),
                            SLOT( updateNode( QModelIndex ) ) );
    connect( &m_dirModel, SIGNAL( dataChangedByUser( const QModelIndex& ) ),
                          SIGNAL( changed() ) );
    connect( &m_dirModel, SIGNAL( modelReset() ),
                            SLOT( modelReset() ) );

    connect( this, SIGNAL( collapsed( QModelIndex ) ),
                     SLOT( onCollapse( QModelIndex ) ) );
    connect( this, SIGNAL( expanded( QModelIndex ) ),
                     SLOT( onExpand( QModelIndex ) ) );
}
Beispiel #2
0
/**
 * Called, if a menu action is toggled.
 */
void KFLogTreeWidget::slotMenuActionTriggered( QAction* action )
{
  int columnIdx = action->data().toInt();

  if( columnIdx == -1 )
    {
      // All columns should be switched on.
      QList<QAction *> actions = menuActionGroup->actions ();

      for( int i = 0; i < actions.size(); i++ )
        {
          columnIdx = actions.at(i)->data().toInt();

          if( columnIdx == -1 )
            {
              continue;
            }

          setColumnHidden( columnIdx, false );
          actions.at(i)->setChecked( true );
        }

      slotResizeColumns2Content();
      return;
    }

  // Only one column has to handle.
  setColumnHidden( columnIdx, ( action->isChecked() == false ) );
  slotResizeColumns2Content();
}
Beispiel #3
0
void SongListView::configHeaders(){
  QSqlRecord record = songListEntryModel->record();
  int libIdIndex = record.indexOf(DataStore::getLibIdAlias());
  int idIndex = record.indexOf(DataStore::getSongListEntryIdColName());
  int durationIndex = record.indexOf(DataStore::getLibDurationColName());
  setColumnHidden(libIdIndex, true);
  setColumnHidden(idIndex, true);
  resizeColumnToContents(durationIndex);
}
Beispiel #4
0
void LibraryView::configureColumns(){
  QSqlRecord record = libraryModel->record();
  int idIndex = record.indexOf(DataStore::getLibIdColName());
  int isDeletedIndex = record.indexOf(DataStore::getLibIsDeletedColName());
  int syncStatusIndex = record.indexOf(DataStore::getLibSyncStatusColName());
  int durationIndex = record.indexOf(DataStore::getLibDurationColName());
  setColumnHidden(idIndex, true);
  setColumnHidden(isDeletedIndex, true); 
  setColumnHidden(syncStatusIndex, true); 
  resizeColumnToContents(durationIndex);
}
Beispiel #5
0
void AvailableMusicView::configHeaders(){
  QSqlRecord record = availableMusicModel->record();
  int syncIndex =   
    record.indexOf(DataStore::getAvailableEntrySyncStatusColName());
  int libIdIndex =
    record.indexOf(DataStore::getAvailableEntryLibIdColName());
  int durationIndex = record.indexOf(DataStore::getLibDurationColName());
  setColumnHidden(syncIndex, true);
  setColumnHidden(libIdIndex, true);
  resizeColumnToContents(durationIndex);
}
void ItemViewWidget::showEvent(QShowEvent *event)
{
	if (m_isInitialized)
	{
		QTreeView::showEvent(event);

		return;
	}

	const QString name = objectName();
	const QString suffix = QLatin1String("ViewWidget");
	const QString type = (name.endsWith(suffix) ? name.left(name.size() - suffix.size()) : name);

	if (type.isEmpty())
	{
		return;
	}

	Settings settings(SessionsManager::getReadableDataPath(QLatin1String("views.ini")));
	settings.beginGroup(type);

	setSort(settings.getValue(QLatin1String("sortColumn"), -1).toInt(), ((settings.getValue(QLatin1String("sortOrder"), QLatin1String("ascending")).toString() == QLatin1String("ascending")) ? Qt::AscendingOrder : Qt::DescendingOrder));

	const QStringList columns = settings.getValue(QLatin1String("columns")).toString().split(QLatin1Char(','), QString::SkipEmptyParts);

	if (!columns.isEmpty())
	{
		for (int i = 0; i < model()->columnCount(); ++i)
		{
			setColumnHidden(i, true);
		}

		disconnect(m_headerWidget, SIGNAL(sectionMoved(int,int,int)), this, SLOT(saveState()));

		for (int i = 0; i < columns.count(); ++i)
		{
			setColumnHidden(columns[i].toInt(), false);

			if (m_headerWidget)
			{
				m_headerWidget->moveSection(m_headerWidget->visualIndex(columns[i].toInt()), i);
			}
		}

		connect(m_headerWidget, SIGNAL(sectionMoved(int,int,int)), this, SLOT(saveState()));
	}

	m_headerWidget->setStretchLastSection(true);

	m_isInitialized = true;

	QTreeView::showEvent(event);
}
void ItemLibraryTreeView::setModel(QAbstractItemModel *model)
{
    QFileSystemModel *fileSystemModel = dynamic_cast<QFileSystemModel *>(model);
    if (fileSystemModel) {
        QTreeView::setModel(model);
        m_delegate->setModel(fileSystemModel);
        setColumnHidden(1, true);
        setColumnHidden(2, true);
        setColumnHidden(3, true);
        setSortingEnabled(true);
    }
}
Beispiel #8
0
PlaylistView::PlaylistView(UDJServerConnection* serverConnection, MusicLibrary* musicLibrary, QWidget* parent):
  QTableView(parent),
  musicLibrary(musicLibrary),
  serverConnection(serverConnection)
{
  playlistModel = new PlaylistModel(serverConnection, this);
  horizontalHeader()->setStretchLastSection(true);
  setItemDelegateForColumn(6, new PlaylistDelegate(this));
  setModel(playlistModel);
  setColumnHidden(0,true);
  setColumnHidden(1,true);
  setColumnHidden(5,true);
  setSelectionBehavior(QAbstractItemView::SelectRows);
}
Beispiel #9
0
void TableView::setColumnsHidden(QList<int> columns)
{
    for (int column = 0; column < columns.count(); ++column)
    {
        setColumnHidden(columns.value(column),true);
    }
}
Beispiel #10
0
void StackTreeView::showAddressColumn(bool on)
{
    setColumnHidden(StackAddressColumn, !on);
    resizeColumnToContents(StackLevelColumn);
    resizeColumnToContents(StackLineNumberColumn);
    resizeColumnToContents(StackAddressColumn);
}
void ItemViewWidget::setColumnVisibility(int column, bool hide)
{
	if (column < 0)
	{
		for (int i = 0; i < model()->columnCount(); ++i)
		{
			setColumnHidden(i, hide);
		}
	}
	else
	{
		setColumnHidden(column, hide);
	}

	saveState();
}
Beispiel #12
0
/**************************************************************************
  Displays menu on header by right clicking
**************************************************************************/
void plr_widget::display_header_menu(const QPoint &)
{
  struct player_dlg_column *pcol;
  QMenu hideshowColumn(this);
  hideshowColumn.setTitle(_("Column visibility"));
  QList<QAction *> actions;
  for (int i = 0; i < list_model->columnCount(); ++i) {
    QAction *myAct = hideshowColumn.addAction(
                       list_model->headerData(i, Qt::Horizontal, 
                                              Qt::DisplayRole).toString());
    myAct->setCheckable(true);
    myAct->setChecked(!isColumnHidden(i));
    actions.append(myAct);
  }
  QAction *act = hideshowColumn.exec(QCursor::pos());
  if (act) {
    int col = actions.indexOf(act);
    Q_ASSERT(col >= 0);
    pcol = &player_dlg_columns[col];
    pcol->show = !pcol->show;
    setColumnHidden(col, !isColumnHidden(col));
    if (!isColumnHidden(col) && columnWidth(col) <= 5)
      setColumnWidth(col, 100);
  }
}
Beispiel #13
0
void QMailTreeView::init()
{

    QMailSortFilterProxyModel::instance()->setSourceModel(QMailTreeModel::instance());
    setModel(QMailSortFilterProxyModel::instance());
    setSortingEnabled(true);
    sortByColumn(MLMCE_Date, Qt::DescendingOrder);
    m_pMailTreeViewHeader = new QMailTreeViewHeader(this);
    setHeader(m_pMailTreeViewHeader);
    connect(m_pMailTreeViewHeader, SIGNAL(refreshAccountsMailList()), this, SLOT(onRefreshAccountMails()));
    
    setItemDelegate(new QMailItemDelegate(this));
    for (int column = 0; column < QMailTreeModel::instance()->columnCount(); ++column)
        resizeColumnToContents(column);
    setColumnHidden(MLMCE_Priority, true);

    //右键菜单设置
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(slotCustomContextMenu(const QPoint &)));
    //支持多选 支持shift, ctrl, 鼠标框框等方式
    setSelectionMode(ExtendedSelection);
    connect(this, SIGNAL(entered(const QModelIndex &)), this, SLOT(slotEntered(const QModelIndex &)));
    //用于显示ToolTip
    setMouseTracking(true);
    expandAll();
}
void TransferListWidget::hidePriorityColumn(bool hide)
{
    qDebug("hidePriorityColumn(%d)", hide);
    setColumnHidden(TorrentModel::TR_PRIORITY, hide);
    if (!hide && !columnWidth(TorrentModel::TR_PRIORITY))
        resizeColumnToContents(TorrentModel::TR_PRIORITY);
}
Beispiel #15
0
void EventGoersView::configHeaders(){
  QSqlRecord record = eventGoersModel->record();
  int usernameIndex = record.indexOf(DataStore::getEventGoerUsernameColName());
  int idIndex = record.indexOf(DataStore::getEventGoersIdColName());
  setColumnHidden(idIndex, true);
  eventGoersModel->setHeaderData(
    usernameIndex, Qt::Horizontal, tr("User"), Qt::DisplayRole);
}
Beispiel #16
0
/**************************************************************************
  Hides columns in plr widget, depending on info from plr_list
**************************************************************************/
void plr_widget::hide_columns()
{
  for (int col = 0; col < list_model->columnCount(); col++) {
   if(!list_model->hide_data(col).toBool()){
    setColumnHidden(col, !isColumnHidden(col));
   }
  }
}
Beispiel #17
0
void DeviceExplorerView::columnVisibilityChanged(bool shown)
{
  QAction* a = qobject_cast<QAction*>(sender());
  SCORE_ASSERT(a);
  const int ind = m_actions.indexOf(a);
  SCORE_ASSERT(ind != -1);
  setColumnHidden(ind, !shown);
}
Beispiel #18
0
TradeTable::TradeTable(QList<TradeItem>& itemList,const QString& columnJsonFile,QWidget* parent):m_ItemList(itemList),QTableView(parent)
{
	m_ColumnJsonFile = columnJsonFile;
	this->LoadColumnJson();
		
	m_Delegate = new TableItemDelegate(m_ColumnMap);
	m_TableModel = new TableModel(itemList,m_ColumnMap,this);

	this->setModel(m_TableModel);
	this->setItemDelegate(m_Delegate); //在单元格中显示图片;
	this->setHorizontalHeader(new TradeHeaderView(m_ColumnMap,Qt::Horizontal,this));//设置列标题;

	this->setSelectionBehavior(QAbstractItemView::SelectItems);//选择一项;

	this->verticalHeader()->hide();	  //隐藏垂直方向上的标头; //this->verticalHeader()->setVisible(false);
	this->setSelectionMode(QAbstractItemView::SingleSelection);
	this->setEditTriggers(QAbstractItemView::NoEditTriggers);
	this->setContextMenuPolicy(Qt::CustomContextMenu);

	this->resizeColumnsToContents(); //列宽随列标题内容而缩放,下类同;
	this->resizeRowsToContents();

	this->setAlternatingRowColors(true);  //交替行颜色; 
	QString tableBgStyle = "QHeaderView::section{height:28px;background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop: 0 #eeeeee, stop: 1 #555555);color: black;padding-left: 4px;border: 1px solid #6c6c6c;}"
						   "QTableView{font-size:18px; color:black; background-color:white;alternate-background-color:rgb(192,192,192);}";
	this->setStyleSheet(tableBgStyle);

	this->setMouseTracking(true);	//鼠标经过时高亮显示;

	QString vScrollBarStyle = "QScrollBar:vertical{ width:20px; background:rgba(0,0,0,0%); margin:0px,0px,0px,0px; padding-top:21px; padding-bottom:21px; }"
							  "QScrollBar::handle:vertical{width:20px;background:rgba(0,0,0,20%);border-radius:4px;min-height:20;}"
							  "QScrollBar::handle:vertical:hover{width:20px;background:qlineargradient(x1:0, y1:0, x2:1, y2:0, stop: 0 #eeeeee, stop: 1 #555555);border-radius:4px;min-height:20;}"
							  "QScrollBar::add-line:vertical{height:21px;width:20px;border-image:url(images/ListTab/3.png);subcontrol-position:bottom;}"
							  "QScrollBar::sub-line:vertical{height:21px;width:20px;border-image:url(images/ListTab/1.png);subcontrol-position:top;}"
							  "QScrollBar::add-line:vertical:hover{height:21px;width:20px;border-image:url(images/ListTab/4.png);subcontrol-position:bottom;}"
							  "QScrollBar::sub-line:vertical:hover{height:21px;width:20px;border-image:url(images/ListTab/2.png);subcontrol-position:top;}"
							  "QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical{background:rgba(0,0,0,10%);border-radius:4px;}";

 	QString hScrollBarStyle = "QScrollBar:horizontal{ height:20px; background:rgba(0,0,0,0%); margin:0px,0px,0px,0px; padding-left:21px; padding-right:21px; }"
							  "QScrollBar::handle:horizontal{height:20px;background:rgba(0,0,0,20%);border-radius:4px;min-width:20;}"
							  "QScrollBar::handle:horizontal:hover{width:20px;background:qlineargradient(x1:0, y1:0, x2:0, y2:1, stop: 0 #eeeeee, stop: 1 #555555);border-radius:4px;min-width:20;}"
							  "QScrollBar::add-line:horizontal{width:21px;height:20px;border-image:url(images/ListTab/30.png);subcontrol-position:right;}"
							  "QScrollBar::sub-line:horizontal{width:21px;height:20px;border-image:url(images/ListTab/10.png);subcontrol-position:left;}"
							  "QScrollBar::add-line:horizontal:hover{width:21px;height:20px;border-image:url(images/ListTab/40.png);subcontrol-position:right;}"
							  "QScrollBar::sub-line:horizontal:hover{width:21px;height:20px;border-image:url(images/ListTab/20.png);subcontrol-position:left;}"
							  "QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal{background:rgba(0,0,0,10%);border-radius:4px;}";

	this->horizontalScrollBar()->setStyleSheet(hScrollBarStyle);
	this->verticalScrollBar()->setStyleSheet(vScrollBarStyle);

	this->setContextMenuPolicy(Qt::ActionsContextMenu);	//菜单;

	for(int i=0;i<m_ColumnMap.count();i++)
	{
		if(!m_ColumnMap[i].IsShow())
			setColumnHidden(i,true);
	}
}
Beispiel #19
0
void QExTreeView::slotCleanExParams()
{
    for (int i = 0; i < header()->count(); i++) {
        QString columnName = model()->headerData(i, Qt::Horizontal).toString();
        if (columnName[0] == '_') {
            setColumnHidden(i,true);
        }
    }
}
Beispiel #20
0
OrderLineView::OrderLineView(QWidget* parent) : 
	QTableView(parent)
{
	setSelectionMode(QAbstractItemView::SingleSelection);
	setSelectionBehavior(QAbstractItemView::SelectRows);
	setEditTriggers(QAbstractItemView::NoEditTriggers);
	resizeColumnsToContents();
	setColumnHidden(0, true);
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
Beispiel #21
0
void PlayListWidget::refreshConfig(){
// 	qDebug() << this << "refreshConfig()";
	disconnectConfigUpdate();
	for(int i=0; i<columnCount(); ++i){
		setColumnHidden(i,!tabs->columnsVisibility[i]);
		setColumnWidth(i, (int)((double)visibleWidth() * tabs->columnsWidth[i]));
		header()->moveSection(header()->visualIndex(i), tabs->columnsPosition[i]);
	}
	connectConfigUpdate();
}
Beispiel #22
0
void UTableRecycleBin::setVisibleColumnTable(QList <bool> &list)
{
    listVisibleColumn = list;

    for(int i = 0; i < listVisibleColumn.size(); i++)
    {
        bool visible = listVisibleColumn.at(i);
        setColumnHidden(i, !visible);
    }
}
Beispiel #23
0
void InstrumentTree::updateHeader()/*{{{*/
{
    //update the patchList headers as well
    QStandardItem* pid = new QStandardItem("");
    QStandardItem* patch = new QStandardItem(tr("Select Patch"));
    patch->setTextAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
    _patchModel->setHorizontalHeaderItem(0, patch);
    _patchModel->setHorizontalHeaderItem(1, pid);
    setColumnHidden(1, true);
}/*}}}*/
CheckFileSystemView::CheckFileSystemView( QWidget* parent )
    :QTreeView( parent )
{
    m_fsModel = new CheckFileSystemModel( this );
    m_fsModel->setRootPath( "" );
    m_fsModel->setFilter( QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks );
    setModel( m_fsModel );

    setRootIndex( m_fsModel->index( "" ) );

    setColumnHidden(1, true);
    setColumnHidden(2, true);
    setColumnHidden(3, true);
    //header()->hide();

    connect( m_fsModel, SIGNAL(dataChangedByUser(const QModelIndex&)), SLOT(updateNode(const QModelIndex&)));
    connect( m_fsModel, SIGNAL(dataChangedByUser(const QModelIndex&)), SIGNAL(dataChanged()));
    connect( this, SIGNAL(collapsed(const QModelIndex&)), SLOT(onCollapse(const QModelIndex&)));
    connect( this, SIGNAL(expanded(const QModelIndex&)), SLOT(onExpand(const QModelIndex&)));
}
Beispiel #25
0
void NickView::init()
{
    if (!model())
        return;

    for (int i = 1; i < model()->columnCount(); i++)
        setColumnHidden(i, true);

    connect(selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), SIGNAL(selectionUpdated()));
    connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SIGNAL(selectionUpdated()));
}
Beispiel #26
0
void KNMusicTreeViewBase::resetHeaderState()
{
    //Hide all column first.
    for(int i=Name+1; i<MusicDataCount; i++)
    {
        setColumnHidden(i, true);
    }
    //Show the default columns.
    setColumnHidden(Time, false);
    setColumnHidden(Artist, false);
    setColumnHidden(Album, false);
    setColumnHidden(Genre, false);
    setColumnHidden(Rating, false);
    //Reorder the columns.
    moveToFirst(Rating);
    moveToFirst(Genre);
    moveToFirst(Album);
    moveToFirst(Artist);
    moveToFirst(Time);
    moveToFirst(Name);
    //Set the default width.
    setColumnWidth(Genre, 81);
    setColumnWidth(Album, 126);
    setColumnWidth(Artist, 126);
    setColumnWidth(Time, 60);
    setColumnWidth(Name, 200);
}
Beispiel #27
0
void TreeWidget::setDocumentModel( DocumentModel *model )
{
	setModel( m = model );
	header()->setStretchLastSection( false );
	header()->setResizeMode( DocumentModel::Name, QHeaderView::Stretch );
	header()->setResizeMode( DocumentModel::Mime, QHeaderView::ResizeToContents );
	header()->setResizeMode( DocumentModel::Size, QHeaderView::ResizeToContents );
	header()->setResizeMode( DocumentModel::Save, QHeaderView::ResizeToContents );
	header()->setResizeMode( DocumentModel::Remove, QHeaderView::ResizeToContents );
	setColumnHidden( DocumentModel::Mime, true );
	connect( this, SIGNAL(clicked(QModelIndex)), SLOT(clicked(QModelIndex)) );
	connect( this, SIGNAL(doubleClicked(QModelIndex)), m, SLOT(open(QModelIndex)) );
}
Beispiel #28
0
ListTypeWidget::ListTypeWidget(QWidget* parent) : QTableView(parent) {
  model_ = new ListTableModelInner(this);
  setModel(model_);

  setColumnHidden(KeyValueTableItem::kValue, true);

  ActionDelegate* del = new ActionDelegate(this);
  VERIFY(connect(del, &ActionDelegate::addClicked, this, &ListTypeWidget::addRow));
  VERIFY(connect(del, &ActionDelegate::removeClicked, this, &ListTypeWidget::removeRow));

  setItemDelegateForColumn(KeyValueTableItem::kAction, del);
  setContextMenuPolicy(Qt::ActionsContextMenu);
  setSelectionBehavior(QAbstractItemView::SelectRows);
}
void BookmarksTreeView::setViewType(BookmarksTreeView::ViewType type)
{
    m_type = type;

    switch (m_type) {
    case BookmarksManagerViewType:
        setColumnHidden(1, false);
        setHeaderHidden(false);
        setMouseTracking(false);
        setSelectionMode(QAbstractItemView::ExtendedSelection);
        break;
    case BookmarksSidebarViewType:
        setColumnHidden(1, true);
        setHeaderHidden(true);
        setMouseTracking(true);
        setSelectionMode(QAbstractItemView::SingleSelection);
        break;
    default:
        break;
    }

    restoreExpandedState(QModelIndex());
}
MyTable::MyTable(QWidget* parent)
    : QTableView(/*RowCount, ColumnCount, */ parent)
    , m_header(new MyHeader(Qt::Vertical, this))
    , m_model(new MyTableModel(this))
#ifdef EXCEL
    , excel(new Excel::Application(this))
#endif
{
    setModel(m_model);
    setVerticalHeader(m_header);

    connect(m_model, &MyTableModel::dataChanged, [=](const QModelIndex& topLeft, const QModelIndex& /*bottomRight*/, const QVector<int>& /*roles*/) {
        updatePlot(topLeft.row());
        resizeRowToContents(topLeft.row());
    });

    QAbstractButton* cornerButton = findChild<QAbstractButton*>();
    if (cornerButton) {
        c = new QCheckBox("№", cornerButton);
        c->setGeometry(cornerButton->rect() + QMargins(-5, 0, 100, 0));
        connect(c, &QCheckBox::toggled, [this](bool checked) { m_header->setChecked(checked); });
    }

    connect(m_header, &MyHeader::checkedChanged, m_model, &MyTableModel::setRowsEnabled);

    setColumnHidden(MeasureDeltaCh0, true);
    setColumnHidden(MeasureDeltaCh1, true);

    horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    horizontalHeader()->setSectionResizeMode(MeasureCh0, QHeaderView::Stretch);
    horizontalHeader()->setSectionResizeMode(MeasureCh1, QHeaderView::Stretch);

    setIconSize(QSize(24, 24));
#ifdef EXCEL
    excel->SetVisible(true);
#endif
}