long FOX16_GuiSortingList::onHeaderClicked(FXObject*, FXSelector, void* ptr) {
  FXint idx=(FXint)(FXival)ptr;
  FXbool b;
  int i;

  b=header->getArrowDir(idx);
  for (i=0; i<header->getNumItems(); i++)
    header->setArrowDir(i, MAYBE);

  if (b==TRUE) {
    /* was up, becomes down */
    header->setArrowDir(idx, FALSE);
    sortByColumn(idx, false);
  }
  else if (b==FALSE) {
    /* was down, becomes MAYBE */
    header->setArrowDir(idx, MAYBE);
  }
  else {
    /* was MAYBE, becomes up */
    header->setArrowDir(idx, TRUE);
    sortByColumn(idx, true);
  }
  return 1;
}
Exemplo n.º 2
0
void EntryView::switchToGroupMode()
{
    m_sortModel->hideColumn(0, true);
    sortByColumn(-1, Qt::AscendingOrder);
    sortByColumn(0, Qt::AscendingOrder);
    m_inEntryListMode = false;
}
Exemplo n.º 3
0
// NOTE! This loses trip selection, because while we remember the
// dives, we don't remember the trips (see the "currentSelectedDives"
// list). I haven't figured out how to look up the trip from the
// index. TRIP_ROLE vs DIVE_ROLE?
void DiveListView::headerClicked(int i)
{
	QItemSelection oldSelection = selectionModel()->selection();
	QList<struct dive*> currentSelectedDives;
	DiveTripModel::Layout newLayout;
	bool first = true;

	newLayout = i == (int) TreeItemDT::NR ? DiveTripModel::TREE : DiveTripModel::LIST;

	Q_FOREACH(const QModelIndex& index , oldSelection.indexes()) {
		if (index.column() != 0) // We only care about the dives, so, let's stick to rows and discard columns.
			continue;

		struct dive *d = (struct dive *) index.data(TreeItemDT::DIVE_ROLE).value<void*>();
		if (d)
			currentSelectedDives.push_back(d);
	}

	unselectDives();

	/* No layout change? Just re-sort, and scroll to first selection, making sure all selections are expanded */
	if (currentLayout == newLayout) {
		sortByColumn(i);
	} else {
		// clear the model, repopulate with new indexes.
		reload(newLayout, false);
		sortByColumn(i, Qt::DescendingOrder);
	}

	// repopulate the selections.
	Q_FOREACH(struct dive *d, currentSelectedDives) {
		selectDive(d, first);
		first = false;
	}
Exemplo n.º 4
0
void EntryView::switchToEntryListMode()
{
    m_sortModel->hideColumn(0, false);
    sortByColumn(1, Qt::AscendingOrder); // TODO: should probably be improved
    sortByColumn(0, Qt::AscendingOrder);
    m_inEntryListMode = true;
}
Exemplo n.º 5
0
void MethodViewer::setObject(QObject *object) {
	const QMetaObject *metaObject = object->metaObject();

	setSortingEnabled(false);
	clear();
	for (int i = 0; i < metaObject->methodCount(); i++) {
		QMetaMethod method = metaObject->method(i);
		addTopLevelItem(new Item(object, method));
	}

	setSortingEnabled(true);
	sortByColumn(1, Qt::AscendingOrder);
	sortByColumn(0, Qt::AscendingOrder);
}
CategoryFilterWidget::CategoryFilterWidget(QWidget *parent)
    : QTreeView(parent)
{
    CategoryFilterProxyModel *proxyModel = new CategoryFilterProxyModel(this);
    proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
    proxyModel->setSourceModel(new CategoryFilterModel(this));
    setModel(proxyModel);
    setFrameShape(QFrame::NoFrame);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    setUniformRowHeights(true);
    setHeaderHidden(true);
    setIconSize(Utils::Misc::smallIconSize());
#if defined(Q_OS_MAC)
    setAttribute(Qt::WA_MacShowFocusRect, false);
#endif
    setContextMenuPolicy(Qt::CustomContextMenu);
    sortByColumn(0, Qt::AscendingOrder);
    setCurrentIndex(model()->index(0, 0));

    connect(this, SIGNAL(collapsed(QModelIndex)), SLOT(callUpdateGeometry()));
    connect(this, SIGNAL(expanded(QModelIndex)), SLOT(callUpdateGeometry()));
    connect(this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showMenu(QPoint)));
    connect(selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex))
            , SLOT(onCurrentRowChanged(QModelIndex,QModelIndex)));
    connect(model(), SIGNAL(modelReset()), SLOT(callUpdateGeometry()));
}
Exemplo n.º 7
0
CommitTableWidget::CommitTableWidget(QWidget *parent)
// ----------------------------------------------------------------------------
//    Create a CommitTableWidget
// ----------------------------------------------------------------------------
    : QTableView(parent)
{
    table = new CommitTableModel(this);

    proxyModel = new CommitSortFilterProxyModel(this);
    proxyModel->setSourceModel(table);

    setModel(proxyModel);
    setSortingEnabled(true);
    setSelectionBehavior(QAbstractItemView::SelectRows);
    horizontalHeader()->setStretchLastSection(true);
    verticalHeader()->hide();
    setEditTriggers(QAbstractItemView::NoEditTriggers);
    setSelectionMode(QAbstractItemView::SingleSelection);

    sortByColumn(1, Qt::DescendingOrder);
    horizontalHeader()->setSortIndicator(1, Qt::DescendingOrder);

    connect(selectionModel(),
            SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
            this, SLOT(onSelectionChanged()));
}
Exemplo n.º 8
0
NickView::NickView(QWidget *parent)
    : TreeViewTouch(parent)
{
    setIndentation(10);
    header()->hide();
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setSortingEnabled(true);
    sortByColumn(0, Qt::AscendingOrder);

    setContextMenuPolicy(Qt::CustomContextMenu);
    setSelectionMode(QAbstractItemView::ExtendedSelection);

//   // breaks with Qt 4.8
//   if(QString("4.8.0") > qVersion()) // FIXME breaks with Qt versions >= 4.10!
    setAnimated(true);

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

#if defined Q_OS_MACOS || defined Q_OS_WIN
    // afaik this is better on Mac and Windows
    connect(this, SIGNAL(activated(QModelIndex)), SLOT(startQuery(QModelIndex)));
#else
    connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(startQuery(QModelIndex)));
#endif
}
Exemplo n.º 9
0
JobListView::JobListView(const HostInfoManager* manager,
                          QWidget* parent,
                          const char* name)
    : QTreeWidget(parent),
      m_hostInfoManager(manager),
      m_numberOfFilePathParts(2),
      m_expireDuration(-1),
      m_expireTimer(new QTimer(this))
{
    setObjectName(QLatin1String(name));
    qApp->setStyleSheet("QTreeView::branch { border-image: none; image: none }");

    QStringList headers;
    headers << tr("ID") << tr("Filename") << tr("Client") << tr("Server")
            << tr("State") << tr("Real") << tr("User") << tr("Faults")
            << tr("Size In") << tr("Size Out");

    setHeaderLabels(headers);
    const int nHeaders = headers.count();
    setColumnCount(nHeaders);

    // Auto adjust columns according to their content
    QHeaderView* headerView = header();
    for (int i = 0; i < nHeaders; ++i)
        headerView->setResizeMode(i, QHeaderView::ResizeToContents);

    headerView->setStretchLastSection(false);

    setAllColumnsShowFocus(true);
    setSortingEnabled(true);
    sortByColumn(JobColumnID, Qt::DescendingOrder);

    connect(m_expireTimer, SIGNAL(timeout()), this, SLOT(slotExpireFinishedJobs()));
}
Exemplo n.º 10
0
void DataWidgetClass::setAsset(AssetClass *pAsset)
{
    _asset = pAsset;

    QTreeWidgetItem*    pRootItem = new QTreeWidgetItem(this, dv_type_asset);
    pRootItem->setText(dv_col_param_name, pAsset->description());

    QHash<unsigned, DataCollectorClass*>::const_iterator    iter = pAsset->_collectors.constBegin();
    while(iter != pAsset->_collectors.constEnd())
    {
        QTreeWidgetItem*    pItem = new QTreeWidgetItem(this, dv_type_data);
        pItem->setText(dv_col_param_name, iter.value()->_name);
        pItem->setText(dv_col_description, iter.value()->_param);
        if(iter.value()->_isInteger)
        {
            pItem->setText(dv_col_channel, QString("I:%1").arg(iter.value()->_channel, 6));
            pItem->setText(dv_col_value, QString::number(int(iter.value()->_value)));
        }
        else
        {
            pItem->setText(dv_col_channel, QString("F:%1").arg(iter.value()->_channel, 6));
            pItem->setText(dv_col_value, QString::number(iter.value()->_value));
        }

        pItem->setText(dv_col_a, QString::number(iter.value()->_scale));
        pItem->setText(dv_col_b, QString::number(iter.value()->_offset));
        pItem->setText(dv_col_alias, iter.value()->_alias);
        pItem->setData(dv_col_param_name, Qt::UserRole, QVariant::fromValue(reinterpret_cast<void*>(iter.value())));
        pItem->setFlags(pItem->flags() | Qt::ItemIsEditable);
        _DataToItem.insert(iter.value(), pItem);
        ++iter;
    }

    sortByColumn(dv_col_channel, Qt::AscendingOrder);
}
Exemplo n.º 11
0
CategoryFilterWidget::CategoryFilterWidget(QWidget *parent)
    : QTreeView(parent)
{
    auto *proxyModel = new CategoryFilterProxyModel(this);
    proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
    proxyModel->setSourceModel(new CategoryFilterModel(this));
    setModel(proxyModel);
    setFrameShape(QFrame::NoFrame);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    setUniformRowHeights(true);
    setHeaderHidden(true);
    setIconSize(Utils::Gui::smallIconSize());
#ifdef Q_OS_MAC
    setAttribute(Qt::WA_MacShowFocusRect, false);
#endif
    m_defaultIndentation = indentation();
    if (!BitTorrent::Session::instance()->isSubcategoriesEnabled())
        setIndentation(0);
    setContextMenuPolicy(Qt::CustomContextMenu);
    sortByColumn(0, Qt::AscendingOrder);
    setCurrentIndex(model()->index(0, 0));

    connect(this, &QTreeView::collapsed, this, &CategoryFilterWidget::callUpdateGeometry);
    connect(this, &QTreeView::expanded, this, &CategoryFilterWidget::callUpdateGeometry);
    connect(this, &QWidget::customContextMenuRequested, this, &CategoryFilterWidget::showMenu);
    connect(selectionModel(), &QItemSelectionModel::currentRowChanged
            , this, &CategoryFilterWidget::onCurrentRowChanged);
    connect(model(), &QAbstractItemModel::modelReset, this, &CategoryFilterWidget::callUpdateGeometry);
}
QmlProfilerStatisticsMainView::QmlProfilerStatisticsMainView(QmlProfilerStatisticsModel *model) :
    m_model(model)
{
    setViewDefaults(this);
    setObjectName(QLatin1String("QmlProfilerEventsTable"));

    auto sortModel = new QSortFilterProxyModel(this);
    sortModel->setSourceModel(model);
    sortModel->setSortRole(SortRole);
    sortModel->setSortCaseSensitivity(Qt::CaseInsensitive);
    sortModel->setFilterRole(FilterRole);
    sortModel->setFilterKeyColumn(MainType);
    sortModel->setFilterFixedString("+");

    setModel(sortModel);

    connect(this, &QAbstractItemView::activated, this, [this](const QModelIndex &index) {
        jumpToItem(index.data(TypeIdRole).toInt());
    });

    setSortingEnabled(true);
    sortByColumn(DEFAULT_SORT_COLUMN, Qt::DescendingOrder);

    setShowExtendedStatistics(m_showExtendedStatistics);
    setRootIsDecorated(false);

    resizeColumnToContents(MainLocation);
    resizeColumnToContents(MainType);
}
Exemplo n.º 13
0
void ListWidget::init()
{
    auto *lstmodel = new ListModel();
    setSortingEnabled(true);
    sortByColumn(0, Qt::AscendingOrder);
    setModel(lstmodel);
}
Exemplo n.º 14
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();
}
Exemplo n.º 15
0
void testSorting()
{
	static unsigned int k[] = {20,40,60,80,100,10,30,50,70,90};
	static double d[] = {1,2,3,4,5,6,7,8,9,10};
	vector< unsigned int > col;
	col.insert( col.begin(), k, k+10);
	vector< double > entry;
	entry.insert( entry.begin(), d, d+10);
	sortByColumn( col, entry );

	for ( unsigned int i = 0; i < col.size(); ++i )
		assert( col[i] == (i + 1) * 10 );

	assert( entry[0] == 6 );
	assert( entry[1] == 1 );
	assert( entry[2] == 7 );
	assert( entry[3] == 2 );
	assert( entry[4] == 8 );
	assert( entry[5] == 3 );
	assert( entry[6] == 9 );
	assert( entry[7] == 4 );
	assert( entry[8] == 10 );
	assert( entry[9] == 5 );

	/*
	cout << "testing sorting\n";
	for ( unsigned int i = 0; i < col.size(); ++i ) {
		cout << "d[" << i << "]=	" << k[i] << 
		   ", col[" << i << "]= " <<	col[i] << ", e=" << entry[i] << endl;
	}
	cout << endl;
	*/
	cout << "." << flush;
}
Exemplo n.º 16
0
BtTreeView::BtTreeView(QWidget *parent, BtTreeModel::TypeMasks type) :
   QTreeView(parent)
{
   // Set some global properties that all the kids will use.
   setAllColumnsShowFocus(true);
   setContextMenuPolicy(Qt::CustomContextMenu);
   setRootIsDecorated(false);

   setDragEnabled(true);
   setAcceptDrops(true);
   setDropIndicatorShown(true);
   setSelectionMode(QAbstractItemView::ExtendedSelection);

   _type = type;
   _model = new BtTreeModel(this, _type);
   filter = new BtTreeFilterProxyModel(this, _type);
   filter->setSourceModel(_model);
   setModel(filter);
   filter->setDynamicSortFilter(true);
   
   setExpanded(findElement(0), true);
   setSortingEnabled(true);
   sortByColumn(0,Qt::AscendingOrder);
   resizeColumnToContents(0);

   // and one wee connection
   connect( _model, SIGNAL(expandFolder(BtTreeModel::TypeMasks, QModelIndex)), this, SLOT(expandFolder(BtTreeModel::TypeMasks, QModelIndex)));
}
Exemplo n.º 17
0
void CallView::headerClicked(int col)
{
    // name columns should be sortable in both ways
    if (col == 3) return;

    // all others only descending
    sortByColumn(col, Qt::DescendingOrder);
}
Exemplo n.º 18
0
KFindTreeView::KFindTreeView( QWidget *parent,  KfindDlg * findDialog )
    : QTreeView( parent ) ,
    m_contextMenu(0),
    m_kfindDialog(findDialog)
{
    //Configure model and proxy model
    m_model = new KFindItemModel( this );
    m_proxyModel = new KFindSortFilterProxyModel();
    m_proxyModel->setSourceModel( m_model );
    setModel( m_proxyModel );
    
    //Configure QTreeView
    setRootIsDecorated( false );
    setSelectionMode( QAbstractItemView::ExtendedSelection );
    setSortingEnabled( true );
    setDragEnabled( true );
    setContextMenuPolicy( Qt::CustomContextMenu );

    connect( this, SIGNAL(customContextMenuRequested(QPoint)),
                 this, SLOT(contextMenuRequested(QPoint)));
           
    //Mouse single/double click settings
    connect( KGlobalSettings::self(), SIGNAL(settingsChanged(int)), this, SLOT(reconfigureMouseSettings()) );
    reconfigureMouseSettings();
    
    // TODO: this is a workaround until  Qt-issue 176832 has been fixed (from Dolphin)
    connect(this, SIGNAL(pressed(QModelIndex)), this, SLOT(updateMouseButtons()));
                
    //Generate popup menu actions
    m_actionCollection = new KActionCollection( this );
    m_actionCollection->addAssociatedWidget(this);

    KAction * open = KStandardAction::open(this, SLOT(slotExecuteSelected()), this);
    m_actionCollection->addAction( "file_open", open );
    
    KAction * copy = KStandardAction::copy(this, SLOT(copySelection()), this);
    m_actionCollection->addAction( "edit_copy", copy );
    
    KAction * openFolder = new KAction( KIcon("window-new"), i18n("&Open containing folder(s)"), this );
    connect( openFolder, SIGNAL(triggered()), this, SLOT(openContainingFolder()) );
    m_actionCollection->addAction( "openfolder", openFolder );
    
    KAction * del = new KAction( KIcon("edit-delete"), i18n("&Delete"), this );
    connect( del, SIGNAL(triggered()), this, SLOT(deleteSelectedFiles()) );
    del->setShortcut(Qt::SHIFT + Qt::Key_Delete);
    m_actionCollection->addAction( "del", del );
   
    KAction * trash = new KAction( KIcon("user-trash"), i18n("&Move to Trash"), this );
    connect( trash, SIGNAL(triggered()), this, SLOT(moveToTrashSelectedFiles()) );
    trash->setShortcut(Qt::Key_Delete);
    m_actionCollection->addAction( "trash", trash );
    
    header()->setStretchLastSection( true );
    
    sortByColumn( 0, Qt::AscendingOrder );
}
Exemplo n.º 19
0
SelectiveSyncTreeView::SelectiveSyncTreeView(Account *account, QWidget* parent)
    : QTreeWidget(parent), _inserting(false), _account(account)
{
    _loading = new QLabel(tr("Loading ..."), this);
    connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, SLOT(slotItemExpanded(QTreeWidgetItem*)));
    connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(slotItemChanged(QTreeWidgetItem*,int)));
    header()->hide();
    setSortingEnabled(true);
    sortByColumn(0, Qt::AscendingOrder);
}
Exemplo n.º 20
0
void ViewTableListWidget::sortByName()
{
    //按名排序
    if(!sbn)
    {
        sortByColumn(0,Qt::AscendingOrder);
        sbn = true;
    }
    else
    {
       sortByColumn(0,Qt::DescendingOrder);
        sbn = false;
    }
    if(islist == true)
        emit this->showlistmode();
    else if(isicon == true)
        emit this->showiconmode();
    qDebug()<<tr("名称");
    modifyViewTable();
}
Exemplo n.º 21
0
ResultsTree::ResultsTree(ResultList* results, int groupByCol, int sortByCol, QWidget* parent) : QTreeView(parent)
{
	//header()->hide();
	
	groupSortModel = new GroupSortProxyModel(groupByCol);
	groupSortModel->setSourceModel(results);
	QTreeView::setModel(groupSortModel);
	
	if (sortByCol >= 0)
		sortByColumn(sortByCol);
}
Exemplo n.º 22
0
CustomTreeWidget::CustomTreeWidget(QWidget *parent) : QTreeWidget(parent)
{
    connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(onConnContext(QPoint)));
    connect(header(),SIGNAL(sectionClicked(int)),this,SLOT(onHeaderClicked(int)));
    setSortingEnabled(true);
    sort = Qt::AscendingOrder;
    sortByColumn(1,sort);
    setContextMenuPolicy(Qt::ActionsContextMenu);
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    contextMenu = NULL;
}
Exemplo n.º 23
0
void ViewTableListWidget::sortByType()
{
    //按类型排序
    if(!sbt)
    {
        sortByColumn(1,Qt::AscendingOrder);
        sbt = true;
    }
    else
    {
        sortByColumn(1,Qt::DescendingOrder);
        sbt = false;
    }
    if(islist == true)
        emit this->showlistmode();
    else if(isicon == true)
        emit this->showiconmode();
    qDebug()<<tr("类型");
    modifyViewTable();
}
Exemplo n.º 24
0
void ViewTableListWidget::sortByModiTime()
{

    //按修改时间排序
    if(!sbm)
    {
        sortByColumn(3,Qt::AscendingOrder);
        sbm = true;
    }
    else
    {
        sortByColumn(3,Qt::DescendingOrder);
        sbm = false;
    }
    if(islist == true)
        emit this->showlistmode();
    else if(isicon == true)
        emit this->showiconmode();
    qDebug()<<tr("修改时间");
    modifyViewTable();
}
Exemplo n.º 25
0
DGameTree::DGameTree(QWidget* parent_widget) :
	QTreeWidget(parent_widget)
{
	m_ui = std::make_unique<Ui::DGameTree>();
	m_ui->setupUi(this);

	SetViewStyle(STYLE_TREE);
	setIconSize(QSize(BANNER_WIDTH, BANNER_HEIGHT));
	sortByColumn(COL_TITLE, Qt::AscendingOrder);

	connect(this, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(ItemActivated(QTreeWidgetItem*)));
}
Exemplo n.º 26
0
void CFileListView::modelAboutToBeReset()
{
	_itemUnderCursorBeforeMouseClick = QModelIndex();
	_singleMouseClickValid = false;
	if (_bHeaderAdjustmentRequired)
	{
		_bHeaderAdjustmentRequired = false;
		for (int i = 0; i < model()->columnCount(); ++i)
			resizeColumnToContents(i);
		sortByColumn(ExtColumn, Qt::AscendingOrder);
	}
}
Exemplo n.º 27
0
TableWidget::TableWidget(QWidget *parent) : QTableWidget(parent){

    originCols_ <<0<<1<<2<<5;
    resultCols_ <<3<<4;

    resizeColumnAction = new QAction(tr("Auto resize columns"), this); resizeColumnAction->setCheckable(true);
    resizeRowAction = new QAction(tr("Auto resize rows"), this); resizeRowAction->setCheckable(true);
    matchByTrackAction = new QAction(tr("Match by track"), this); matchByTrackAction->setData( MATCH_BY_TRACK ); matchByTrackAction->setCheckable(true);
    matchByTitleAction = new QAction(tr("Match by title"), this); matchByTitleAction->setData( MATCH_BY_TITLE ); matchByTitleAction->setCheckable(true);
    dontMatchAction = new QAction(tr("Do not match"), this); dontMatchAction->setData( DONT_MATCH ); dontMatchAction->setCheckable(true);
    matchByTrackTitleAction = new QAction(tr("Match by track, then title, then title to filename"), this); matchByTrackTitleAction->setData( MATCH_BY_TRACK_TITLE ); matchByTrackTitleAction->setCheckable(true);
    matchByTitleTrackAction = new QAction(tr("Match by title, then track, then title to filename"), this); matchByTitleTrackAction->setData( MATCH_BY_TITLE_TRACK ); matchByTitleTrackAction->setCheckable(true);
    matchByFileNameAction = new QAction(tr("Match title to filename"), this); matchByFileNameAction->setData( MATCH_BY_FILE_NAME ); matchByFileNameAction->setCheckable(true);

    //context menu
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenu(const QPoint &)));
    contextMenu(QPoint(), true ); //initialize actions

    //verticla header context menu
    this->verticalHeader()->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this->verticalHeader(), SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(verticalContextMenu(const QPoint &)));
    verticalContextMenu(QPoint(), true ); //initialize actions

    connect( this, SIGNAL( cellChanged( int, int )  ), this, SLOT( updateCell(int, int) ) );

    settings = Global::guiSettings();

    resizeColumns( settings->value("SearchDialog/autoResizeColumns",true).toBool() );
    resizeColumnAction->setChecked( settings->value("SearchDialog/autoResizeColumns",true).toBool() );
    resizeRows( settings->value("SearchDialog/autoResizeRows",false).toBool() );
    resizeRowAction->setChecked( settings->value("SearchDialog/autoResizeRows",false).toBool() );
    setSortingEnabled( settings->value("SearchDialog/sortingEnabled",true).toBool() );
    if( isSortingEnabled() ){
        int sortColumn = settings->value("SearchDialog/sortColumn",CURRENT_TRACK).toInt();
        Qt::SortOrder sortOrder = (Qt::SortOrder)settings->value("SearchDialog/sortOrder", Qt::AscendingOrder ).toInt();
        sortByColumn( sortColumn, sortOrder );
        horizontalHeader()->setSortIndicator(sortColumn, sortOrder);
        horizontalHeader()->setSortIndicatorShown(true);
        horizontalHeader()->setClickable(true);
    }
    matchByTrackAction->setChecked( settings->value("SearchDialog/matchByTrack",false).toBool() );
    matchByTitleAction->setChecked( settings->value("SearchDialog/matchByTitle",false).toBool() );
    dontMatchAction->setChecked( settings->value("SearchDialog/dontMacth",true).toBool() );
    matchByTrackTitleAction->setChecked( settings->value("SearchDialog/matchByTrackTitle",true).toBool() );
    matchByTitleTrackAction->setChecked( settings->value("SearchDialog/matchByTitleTrack",false).toBool() );
    matchByFileNameAction->setChecked( settings->value("SearchDialog/matchByFileName",false).toBool() );

    this->horizontalHeader()->setStretchLastSection(true);
    this->verticalHeader()->setStretchLastSection(true);

}
Exemplo n.º 28
0
void PacketList::clear() {
    //    packet_history_clear();
    related_packet_delegate_.clear();
    packet_list_model_->clear();
    proto_tree_->clear();
    byte_view_tab_->clear();

    /* XXX is this correct in all cases?
     * Reset the sort column, use packetlist as model in case the list is frozen.
     */
    sortByColumn(-1, Qt::AscendingOrder);
    setColumnVisibility();
}
Exemplo n.º 29
0
void CoverageView::headerClicked(int col)
{
    // distance and name columns should be sortable in both ways
    if (_showCallers) {
        if ((col == 1) || (col==3)) return;
    }
    else {
        if ((col == 2) || (col==4)) return;
    }

    // all others only descending
    sortByColumn(col, Qt::DescendingOrder);
}
Exemplo n.º 30
0
/*! \brief the press event on an header
    \param index index of the header has been pressed
*/
void CustomTreeWidget::onHeaderClicked(int index)
{
    if(index == sortColumn()){
        if(sort == Qt::AscendingOrder){
            sort = Qt::DescendingOrder;
        }else{
            sort = Qt::AscendingOrder;
        }
    }else{
        sort = Qt::AscendingOrder;
    }

    sortByColumn(index,sort);
}