void PoitemTableView::setModel(QAbstractItemModel* model) { QTableView::setModel(model); setColumnWidth(ITEM_NUMBER_COL, _itemColumn); setColumnWidth(WAREHOUS_CODE_COL, 100); //_whsColumn too small setColumnWidth(POITEM_QTY_ORDERED_COL, _qtyColumn); setColumnWidth(POITEM_UNITPRICE_COL, _priceColumn); setColumnWidth(EXTPRICE_COL, _moneyColumn); setColumnWidth(POITEM_FREIGHT_COL, _priceColumn); setColumnWidth(POITEM_DUEDATE_COL, _dateColumn); #ifdef QE_PROJECT setColumnWidth(PRJ_NUMBER_COL, 100); #endif #ifdef QE_NONINVENTORY setColumnWidth(EXPCAT_CODE_COL, 100); #endif setColumnWidth(POITEM_VEND_ITEM_NUMBER_COL, _itemColumn); QHeaderView *header = horizontalHeader(); int dest = 0; header->moveSection(header->visualIndex(ITEM_NUMBER_COL), dest++); header->moveSection(header->visualIndex(WAREHOUS_CODE_COL), dest++); header->moveSection(header->visualIndex(POITEM_VEND_ITEM_NUMBER_COL), dest++); #ifdef QE_NONINVENTORY header->moveSection(header->visualIndex(EXPCAT_CODE_COL), dest++); #endif header->moveSection(header->visualIndex(POITEM_QTY_ORDERED_COL), dest++); header->moveSection(header->visualIndex(POITEM_UNITPRICE_COL), dest++); header->moveSection(header->visualIndex(EXTPRICE_COL), dest++); header->moveSection(header->visualIndex(POITEM_FREIGHT_COL), dest++); header->moveSection(header->visualIndex(POITEM_DUEDATE_COL), dest++); #ifdef QE_PROJECT header->moveSection(header->visualIndex(PRJ_NUMBER_COL), dest++); #endif // if we didn't explicitly place the logical section, hide it for (int i = dest; i < header->count(); i++) header->hideSection(header->logicalIndex(i)); #ifdef QE_PROJECT if (! _metrics->boolean("UseProjects")) header->hideSection(header->visualIndex(PRJ_NUMBER_COL)); #endif //header->setStretchLastSection(true); }
EditBookmarksDialog::EditBookmarksDialog(IBookmarks *ABookmarks, const Jid &AStreamJid, const QList<IBookmark> &AList, QWidget *AParent) : QDialog(AParent) { REPORT_VIEW; ui.setupUi(this); setAttribute(Qt::WA_DeleteOnClose,true); setWindowTitle(tr("Edit bookmarks - %1").arg(AStreamJid.uBare())); IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->insertAutoIcon(this,MNI_BOOKMARKS_EDIT,0,0,"windowIcon"); FBookmarks = ABookmarks; FStreamJid = AStreamJid; ui.tbwBookmarks->setRowCount(AList.count()); for (int row=0; row<AList.count(); ++row) { IBookmark bookmark = AList.at(row); setBookmarkToRow(row,bookmark); } QHeaderView *header = ui.tbwBookmarks->horizontalHeader(); header->setSectionsClickable(true); header->setSectionResizeMode(COL_NAME,QHeaderView::ResizeToContents); header->setSectionResizeMode(COL_VALUE,QHeaderView::Stretch); header->setSectionResizeMode(COL_NICK,QHeaderView::ResizeToContents); header->hideSection(COL_SORT); connect(header,SIGNAL(sectionClicked(int)),SLOT(onSortingStateChange(int))); connect(ui.pbtAdd,SIGNAL(clicked()),SLOT(onEditButtonClicked())); connect(ui.pbtEdit,SIGNAL(clicked()),SLOT(onEditButtonClicked())); connect(ui.pbtDelete,SIGNAL(clicked()),SLOT(onEditButtonClicked())); connect(ui.pbtMoveUp,SIGNAL(clicked()),SLOT(onEditButtonClicked())); connect(ui.pbtMoveDown,SIGNAL(clicked()),SLOT(onEditButtonClicked())); connect(ui.bbxButtons,SIGNAL(accepted()),SLOT(onDialogAccepted())); connect(ui.tbwBookmarks,SIGNAL(itemDoubleClicked(QTableWidgetItem *)),SLOT(onTableItemDoubleClicked(QTableWidgetItem *))); }
void ToitemTableView::setModel(QAbstractItemModel* model) { QTableView::setModel(model); setColumnWidth(ITEM_NUMBER_COL, _itemColumn); setColumnWidth(TOITEM_QTY_ORDERED_COL, _qtyColumn); setColumnWidth(TOITEM_STDCOST_COL, _priceColumn); setColumnWidth(TOITEM_FREIGHT_COL, _priceColumn); setColumnWidth(TOITEM_DUEDATE_COL, _dateColumn); #ifdef QE_PROJECT setColumnWidth(PRJ_NUMBER_COL, 100); #endif QHeaderView *header = horizontalHeader(); int dest = 0; header->moveSection(header->visualIndex(ITEM_NUMBER_COL), dest++); header->moveSection(header->visualIndex(TOITEM_QTY_ORDERED_COL), dest++); header->moveSection(header->visualIndex(TOITEM_STDCOST_COL), dest++); header->moveSection(header->visualIndex(TOITEM_FREIGHT_COL), dest++); header->moveSection(header->visualIndex(TOITEM_DUEDATE_COL), dest++); #ifdef QE_PROJECT header->moveSection(header->visualIndex(PRJ_NUMBER_COL), dest++); #endif // if we didn't explicitly place the logical section, hide it for (int i = dest; i < header->count(); i++) header->hideSection(header->logicalIndex(i)); #ifdef QE_PROJECT if (! _metrics->boolean("UseProjects")) header->hideSection(header->visualIndex(PRJ_NUMBER_COL)); #endif //header->setStretchLastSection(true); }
void PoitemTableView::setModel(QAbstractItemModel* model) { if (DEBUG) qDebug("PoitemTableView::setModel(%p)", model); QTableView::setModel(model); setColumnWidth(ITEM_NUMBER_COL, _itemColumn); setColumnWidth(WAREHOUS_CODE_COL, 100); //_whsColumn too small setColumnWidth(POITEM_VEND_ITEM_DESCRIP_COL, 200); setColumnWidth(POITEM_QTY_ORDERED_COL, _qtyColumn); setColumnWidth(POITEM_UNITPRICE_COL, _priceColumn); setColumnWidth(EXTPRICE_COL, _moneyColumn); setColumnWidth(POITEM_FREIGHT_COL, _priceColumn); setColumnWidth(POITEM_DUEDATE_COL, _dateColumn); #ifdef QE_NONINVENTORY setColumnWidth(EXPCAT_CODE_COL, 100); #endif setColumnWidth(POITEM_VEND_ITEM_NUMBER_COL, _itemColumn); QHeaderView *header = horizontalHeader(); int dest = 0; header->moveSection(header->visualIndex(ITEM_NUMBER_COL), dest++); if (_metrics->boolean("MultiWhs")) { header->moveSection(header->visualIndex(WAREHOUS_CODE_COL), dest++); } header->moveSection(header->visualIndex(POITEM_VEND_ITEM_NUMBER_COL), dest++); header->moveSection(header->visualIndex(POITEM_VEND_ITEM_DESCRIP_COL), dest++); #ifdef QE_NONINVENTORY header->moveSection(header->visualIndex(EXPCAT_CODE_COL), dest++); #endif header->moveSection(header->visualIndex(POITEM_QTY_ORDERED_COL), dest++); header->moveSection(header->visualIndex(POITEM_UNITPRICE_COL), dest++); header->moveSection(header->visualIndex(EXTPRICE_COL), dest++); header->moveSection(header->visualIndex(POITEM_FREIGHT_COL), dest++); header->moveSection(header->visualIndex(POITEM_DUEDATE_COL), dest++); // if we didn't explicitly place the logical section, hide it for (int i = dest; i < header->count(); i++) header->hideSection(header->logicalIndex(i)); connect(model, SIGNAL(headerDataChanged(Qt::Orientation, int, int)), this, SLOT(sHeaderDataChanged(Qt::Orientation, int, int))); //header->setStretchLastSection(true); if (DEBUG) qDebug("PoitemTableView::setModel returning"); }
TransfersDialog::TransfersDialog(QWidget *parent) : QWidget(parent) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(download())); connect(ui.downloadsList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(downloadsListContextMenu(QPoint))); connect(ui.uploadsList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(uploadsListContextMenu(QPoint))); //To popup a box informing that a friend is attempting to send a file. //QList<qlonglong> is not a default registerd type for QT's meta-object system, so we must first manually register it. qRegisterMetaType<QList<qlonglong> >("QList<qlonglong>"); QObject::connect(guiNotify, SIGNAL(suggestionReceived(unsigned int, QString, QStringList, QStringList, QList<qlonglong>)), this, SLOT(suggestionReceived(unsigned int, QString, QStringList, QStringList, QList<qlonglong>)), Qt::QueuedConnection); QHeaderView *header = ui.downloadsList->header() ; header->hideSection(DOWNLOAD_FRIEND_ID); header->hideSection(DOWNLOAD_ITEM_TYPE); header->hideSection(DOWNLOAD_ITEM_ID); header->hideSection(DOWNLOAD_FINAL_LOCATION); header = ui.uploadsList->header() ; header->hideSection(UPLOAD_LIBRARYMIXER_ID); header->hideSection(UPLOAD_ITEM_ID); header->hideSection(UPLOAD_ITEM_TYPE); //Without this preliminary resizing, empty columns will visibly resize after view already displayed ui.downloadsList->resizeColumnToContents(DOWNLOAD_NAME_COLUMN); ui.downloadsList->resizeColumnToContents(DOWNLOAD_FRIEND_COLUMN); ui.downloadsList->resizeColumnToContents(DOWNLOAD_SPEED_COLUMN); ui.downloadsList->resizeColumnToContents(DOWNLOAD_REMAINING_COLUMN); ui.downloadsList->resizeColumnToContents(DOWNLOAD_TOTAL_SIZE_COLUMN); ui.downloadsList->resizeColumnToContents(DOWNLOAD_PERCENT_COLUMN); ui.downloadsList->resizeColumnToContents(DOWNLOAD_STATUS_COLUMN); ui.uploadsList->resizeColumnToContents(UPLOAD_FILE_COLUMN); ui.uploadsList->resizeColumnToContents(UPLOAD_FRIEND_COLUMN); ui.uploadsList->resizeColumnToContents(UPLOAD_SPEED_COLUMN); ui.uploadsList->resizeColumnToContents(UPLOAD_TRANSFERRED_COLUMN); ui.uploadsList->resizeColumnToContents(UPLOAD_STATUS_COLUMN); ui.downloadsList->sortItems(0, Qt::AscendingOrder); ui.uploadsList->sortItems(0, Qt::AscendingOrder); connect(files, SIGNAL(responseLendOfferReceived(uint,uint,QString,QStringList,QStringList,QList<qlonglong>)), this, SLOT(responseLendOfferReceived(uint,uint,QString,QStringList,QStringList,QList<qlonglong>)), Qt::QueuedConnection); /* This needs to change in the future, but for now, we simply refresh the entire view (including total transfer rates in corner) once every second. */ QTimer *timer = new QTimer(this); timer->connect(timer, SIGNAL(timeout()), this, SLOT(insertTransfers())); timer->start(1000); }
void FilmsViewList::SetDefaultColumnsView() { DebugPrintFunc( "FilmsViewList::SetDefaultColumnsView" ); // Move to start QHeaderView* header = horizontalHeader(); header->moveSection( FilmItem::IsFavouriteColumn, 0 ); header->moveSection( FilmItem::IsViewedColumn + 1, 0 ); // Hide QList<int> hiddenColumns = { FilmItem::OriginalTitleColumn, FilmItem::CountryColumn, FilmItem::ProducerColumn, FilmItem::ScreenwriterColumn, FilmItem::ComposerColumn, FilmItem::BudgetColumn, FilmItem::ViewsCountColumn, FilmItem::TaglineColumn, FilmItem::StarringColumn, FilmItem::DescriptionColumn, FilmItem::TagsColumn, FilmItem::FileNameColumn, FilmItem::PosterColumn }; for( int column : hiddenColumns ) { header->hideSection( column ); } // Show and resize QList< QPair<int,int> > shownColumns = { { FilmItem::TitleColumn, 150 }, { FilmItem::YearColumn, 50 }, { FilmItem::GenreColumn, 110 }, { FilmItem::DirectorColumn, 110 }, { FilmItem::RatingColumn, 50 }, { FilmItem::IsViewedColumn, 20 }, { FilmItem::IsFavouriteColumn, 20 } }; for( QPair<int,int>& column : shownColumns ) { header->showSection( column.first ); header->resizeSection( column.first, column.second ); } header->setSortIndicator( FilmItem::TitleColumn, Qt::AscendingOrder ); DebugPrintFuncDone( "FilmsViewList::SetDefaultColumnsView" ); }
A2DPTest::A2DPTest(QWidget *parent) :QWidget(parent) { setupUi(this); device = NULL; aplay.closeReadChannel(QProcess::StandardOutput); // | QProcess::StandardError); aplay.closeWriteChannel(); audioFilesModel = new QFileSystemModel; audioFilesModel->setNameFilters(QStringList() << "*.wav"); audioFilesModel->setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); audioFilesModel->setRootPath(QDir::homePath()); treeView->setModel(audioFilesModel); // Just the filname header. QHeaderView *headers = treeView->header(); for (int i = 1; i < headers->length(); i++) headers->hideSection(i); }
void ShapeFileOptionsWidget::removeField(const QString& strName) { if (strName.isEmpty()) { return; } int iColumn = getColumn(strName); if (iColumn != -1) { QHeaderView* pHeader = mpFeatureTree->header(); if (pHeader != NULL) { pHeader->hideSection(iColumn); } } if (mpShapeFile != NULL) { string name = strName.toStdString(); mpShapeFile->removeField(name); } }
int HeaderView::hideSection(lua_State * L) // ( int logicalIndex ) { QHeaderView* obj = QtObject<QHeaderView>::check( L, 1); obj->hideSection( Util::toInt( L, 2 ) ); return 0; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_transferMenu(new QMenu(tr("Download"), this)), m_packageMenu(new QMenu(tr("Package"), this)), m_addUrlsAction(new QAction(QIcon::fromTheme("general_add"), tr("Add URLs"), this)), m_importUrlsAction(new QAction(QIcon::fromTheme("general_toolbar_folder"), tr("Import URLs"), this)), m_retrieveUrlsAction(new QAction(QIcon::fromTheme("general_search"), tr("Retrieve URLs"), this)), m_clipboardUrlsAction(new QAction(QIcon::fromTheme("general_share"), tr("Clipboard URLs"), this)), m_queueAction(new QAction(QIcon("/etc/hildon/theme/mediaplayer/Play.png"), tr("Start all DLs"), this)), m_pauseAction(new QAction(QIcon("/etc/hildon/theme/mediaplayer/Pause.png"), tr("Pause all DLs"), this)), m_propertiesAction(new QAction(QIcon::fromTheme("general_information"), tr("Properties"), this)), m_transferQueueAction(new QAction(tr("Start"), this)), m_transferPauseAction(new QAction(tr("Pause"), this)), m_transferCancelAction(new QAction(tr("Remove"), this)), m_transferCancelDeleteAction(new QAction(tr("Remove and delete files"), this)), m_packageQueueAction(new QAction(tr("Start"), this)), m_packagePauseAction(new QAction(tr("Pause"), this)), m_packageCancelAction(new QAction(tr("Remove"), this)), m_packageCancelDeleteAction(new QAction(tr("Remove and delete files"), this)), m_settingsAction(new QAction(tr("Settings"), this)), m_pluginsAction(new QAction(tr("Load plugins"), this)), m_aboutAction(new QAction(tr("About"), this)), m_concurrentAction(new ValueSelectorAction(tr("Maximum concurrent DLs"), this)), m_nextAction(new ValueSelectorAction(tr("After current DLs"), this)), m_view(new QTreeView(this)), m_toolBar(new QToolBar(this)), m_activeLabel(new QLabel(QString("%1DLs").arg(TransferModel::instance()->activeTransfers()), this)), m_speedLabel(new QLabel(Utils::formatBytes(TransferModel::instance()->totalSpeed()) + "/s", this)) { setWindowTitle("QDL"); setCentralWidget(m_view); addToolBar(Qt::BottomToolBarArea, m_toolBar); menuBar()->addAction(m_concurrentAction); menuBar()->addAction(m_nextAction); menuBar()->addAction(m_queueAction); menuBar()->addAction(m_pauseAction); menuBar()->addAction(m_settingsAction); menuBar()->addAction(m_pluginsAction); menuBar()->addAction(m_aboutAction); m_addUrlsAction->setShortcut(tr("Ctrl+N")); m_importUrlsAction->setShortcut(tr("Ctrl+O")); m_retrieveUrlsAction->setShortcut(tr("Ctrl+F")); m_propertiesAction->setShortcut(tr("Ctrl+I")); m_propertiesAction->setEnabled(false); m_clipboardUrlsAction->setShortcut(tr("Ctrl+U")); m_pluginsAction->setShortcut(tr("Ctrl+L")); m_transferMenu->addAction(m_transferQueueAction); m_transferMenu->addAction(m_transferPauseAction); m_transferMenu->addAction(m_transferCancelAction); m_transferMenu->addAction(m_transferCancelDeleteAction); m_packageMenu->addAction(m_packageQueueAction); m_packageMenu->addAction(m_packagePauseAction); m_packageMenu->addAction(m_packageCancelAction); m_packageMenu->addAction(m_packageCancelDeleteAction); m_concurrentAction->setModel(new ConcurrentTransfersModel(m_concurrentAction)); m_concurrentAction->setValue(Settings::maximumConcurrentTransfers()); m_nextAction->setModel(new ActionModel(m_nextAction)); m_nextAction->setValue(Settings::nextAction()); QLabel *speedIcon = new QLabel(m_toolBar); speedIcon->setPixmap(QIcon::fromTheme("general_received").pixmap(m_toolBar->iconSize())); QWidget *spacer1 = new QWidget(m_toolBar); spacer1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); QWidget *spacer2 = new QWidget(m_toolBar); spacer2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); m_activeLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); m_speedLabel->setMinimumWidth(m_speedLabel->fontMetrics().width("9999.99MB/s")); m_speedLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); m_toolBar->setAllowedAreas(Qt::BottomToolBarArea); m_toolBar->setContextMenuPolicy(Qt::PreventContextMenu); m_toolBar->setMovable(false); m_toolBar->addAction(m_addUrlsAction); m_toolBar->addAction(m_importUrlsAction); m_toolBar->addAction(m_retrieveUrlsAction); m_toolBar->addAction(m_clipboardUrlsAction); m_toolBar->addAction(m_propertiesAction); m_toolBar->addWidget(spacer1); m_toolBar->addWidget(m_activeLabel); m_toolBar->addWidget(spacer2); m_toolBar->addWidget(m_speedLabel); m_toolBar->addWidget(speedIcon); m_view->setModel(TransferModel::instance()); m_view->setSelectionBehavior(QTreeView::SelectRows); m_view->setContextMenuPolicy(Qt::CustomContextMenu); m_view->setEditTriggers(QTreeView::NoEditTriggers); m_view->setExpandsOnDoubleClick(true); m_view->setItemsExpandable(true); m_view->setUniformRowHeights(true); m_view->setAllColumnsShowFocus(true); QHeaderView *header = m_view->header(); if (!header->restoreState(Settings::transferViewHeaderState())) { const QFontMetrics fm = header->fontMetrics(); header->resizeSection(0, 200); header->resizeSection(2, fm.width("999.99MB of 999.99MB (99.99%)")); header->resizeSection(3, fm.width("999.99KB/s")); header->hideSection(1); // Hide priority column } connect(Settings::instance(), SIGNAL(maximumConcurrentTransfersChanged(int)), this, SLOT(onMaximumConcurrentTransfersChanged(int))); connect(Settings::instance(), SIGNAL(nextActionChanged(int)), this, SLOT(onNextActionChanged(int))); connect(TransferModel::instance(), SIGNAL(captchaRequest(TransferItem*)), this, SLOT(showCaptchaDialog(TransferItem*))); connect(TransferModel::instance(), SIGNAL(settingsRequest(TransferItem*)), this, SLOT(showPluginSettingsDialog(TransferItem*))); connect(TransferModel::instance(), SIGNAL(activeTransfersChanged(int)), this, SLOT(onActiveTransfersChanged(int))); connect(TransferModel::instance(), SIGNAL(totalSpeedChanged(int)), this, SLOT(onTotalSpeedChanged(int))); connect(m_transferMenu, SIGNAL(aboutToShow()), this, SLOT(setTransferMenuActions())); connect(m_packageMenu, SIGNAL(aboutToShow()), this, SLOT(setPackageMenuActions())); connect(m_addUrlsAction, SIGNAL(triggered()), this, SLOT(showAddUrlsDialog())); connect(m_importUrlsAction, SIGNAL(triggered()), this, SLOT(showImportUrlsDialog())); connect(m_retrieveUrlsAction, SIGNAL(triggered()), this, SLOT(showRetrieveUrlsDialog())); connect(m_clipboardUrlsAction, SIGNAL(triggered()), this, SLOT(showClipboardUrlsDialog())); connect(m_queueAction, SIGNAL(triggered()), TransferModel::instance(), SLOT(queue())); connect(m_pauseAction, SIGNAL(triggered()), TransferModel::instance(), SLOT(pause())); connect(m_propertiesAction, SIGNAL(triggered()), this, SLOT(showCurrentItemProperties())); connect(m_transferQueueAction, SIGNAL(triggered()), this, SLOT(queueCurrentTransfer())); connect(m_transferPauseAction, SIGNAL(triggered()), this, SLOT(pauseCurrentTransfer())); connect(m_transferCancelAction, SIGNAL(triggered()), this, SLOT(cancelCurrentTransfer())); connect(m_transferCancelDeleteAction, SIGNAL(triggered()), this, SLOT(cancelAndDeleteCurrentTransfer())); connect(m_packageQueueAction, SIGNAL(triggered()), this, SLOT(queueCurrentPackage())); connect(m_packagePauseAction, SIGNAL(triggered()), this, SLOT(pauseCurrentPackage())); connect(m_packageCancelAction, SIGNAL(triggered()), this, SLOT(cancelCurrentPackage())); connect(m_packageCancelDeleteAction, SIGNAL(triggered()), this, SLOT(cancelAndDeleteCurrentPackage())); connect(m_settingsAction, SIGNAL(triggered()), this, SLOT(showSettingsDialog())); connect(m_pluginsAction, SIGNAL(triggered()), this, SLOT(loadPlugins())); connect(m_aboutAction, SIGNAL(triggered()), this, SLOT(showAboutDialog())); connect(m_concurrentAction, SIGNAL(valueChanged(QVariant)), this, SLOT(setMaximumConcurrentTransfers(QVariant))); connect(m_nextAction, SIGNAL(valueChanged(QVariant)), this, SLOT(setNextAction(QVariant))); connect(m_view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); connect(m_view->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(onCurrentRowChanged(QModelIndex))); }