mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed empty names in header drop menu
This commit is contained in:
parent
a8adf8d494
commit
e081567fbc
@ -217,12 +217,20 @@ QMenu *RSTreeWidget::createStandardContextMenu(QMenu *contextMenu)
|
||||
|
||||
QTreeWidgetItem *item = headerItem();
|
||||
int columnCount = item->columnCount();
|
||||
for (int column = 0; column < columnCount; ++column) {
|
||||
for (int column = 0; column < columnCount; ++column)
|
||||
{
|
||||
QMap<int, bool>::const_iterator it = mColumnCustomizable.find(column);
|
||||
if (it != mColumnCustomizable.end() && *it == false) {
|
||||
continue;
|
||||
}
|
||||
QAction *action = headerMenu->addAction(QIcon(), item->text(column), this, SLOT(columnVisible()));
|
||||
QString txt = item->text(column) ;
|
||||
if(txt == "")
|
||||
txt = item->data(column,Qt::UserRole).toString() ;
|
||||
|
||||
if(txt=="")
|
||||
txt = tr("[no title]") ;
|
||||
|
||||
QAction *action = headerMenu->addAction(QIcon(), txt, this, SLOT(columnVisible()));
|
||||
action->setCheckable(true);
|
||||
action->setData(column);
|
||||
action->setChecked(!isColumnHidden(column));
|
||||
|
@ -232,16 +232,21 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
|
||||
QHeaderView_setSectionResizeModeColumn(ttheader, COLUMN_THREAD_TITLE, QHeaderView::Interactive);
|
||||
QHeaderView_setSectionResizeModeColumn(ttheader, COLUMN_THREAD_DISTRIBUTION, QHeaderView::ResizeToContents);
|
||||
|
||||
ttheader->resizeSection (COLUMN_THREAD_DATE, 140);
|
||||
ttheader->resizeSection (COLUMN_THREAD_TITLE, 440);
|
||||
ttheader->resizeSection (COLUMN_THREAD_DISTRIBUTION, 24);
|
||||
ttheader->resizeSection (COLUMN_THREAD_AUTHOR, 150);
|
||||
float f = QFontMetricsF(font()).height()/14.0f ;
|
||||
|
||||
ttheader->resizeSection (COLUMN_THREAD_DATE, 140*f);
|
||||
ttheader->resizeSection (COLUMN_THREAD_TITLE, 440*f);
|
||||
ttheader->resizeSection (COLUMN_THREAD_DISTRIBUTION, 24*f);
|
||||
ttheader->resizeSection (COLUMN_THREAD_AUTHOR, 150*f);
|
||||
|
||||
ui->threadTreeWidget->sortItems(COLUMN_THREAD_DATE, Qt::DescendingOrder);
|
||||
|
||||
/* Set text of column "Read" to empty - without this the column has a number as header text */
|
||||
QTreeWidgetItem *headerItem = ui->threadTreeWidget->headerItem();
|
||||
headerItem->setText(COLUMN_THREAD_READ, "");
|
||||
headerItem->setText(COLUMN_THREAD_READ, "") ;
|
||||
headerItem->setText(COLUMN_THREAD_DISTRIBUTION, "");
|
||||
headerItem->setData(COLUMN_THREAD_READ,Qt::UserRole, tr("Read status")) ; // this is used to display drop menus.
|
||||
headerItem->setData(COLUMN_THREAD_DISTRIBUTION,Qt::UserRole, tr("Distribution"));
|
||||
|
||||
/* add filter actions */
|
||||
ui->filterLineEdit->addFilter(QIcon(), tr("Title"), COLUMN_THREAD_TITLE, tr("Search Title"));
|
||||
@ -257,7 +262,7 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
|
||||
processSettings(true);
|
||||
|
||||
/* Set header sizes for the fixed columns and resize modes, must be set after processSettings */
|
||||
ttheader->resizeSection (COLUMN_THREAD_READ, 24);
|
||||
ttheader->resizeSection (COLUMN_THREAD_READ, 24*f);
|
||||
QHeaderView_setSectionResizeModeColumn(ttheader, COLUMN_THREAD_READ, QHeaderView::Fixed);
|
||||
ttheader->hideSection (COLUMN_THREAD_CONTENT);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user