mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-14 17:07:17 -05:00
Merge pull request #2259 from PhenomRetroShare/Fix_GxsGroupHeaderLastStretch
Fix to get Gxs Group last column stretchable.
This commit is contained in:
commit
2e9408a386
@ -97,11 +97,11 @@ GroupTreeWidget::GroupTreeWidget(QWidget *parent) :
|
|||||||
|
|
||||||
QTreeWidgetItem *headerItem = ui->treeWidget->headerItem();
|
QTreeWidgetItem *headerItem = ui->treeWidget->headerItem();
|
||||||
headerItem->setText(GTW_COLUMN_NAME, tr("Name"));
|
headerItem->setText(GTW_COLUMN_NAME, tr("Name"));
|
||||||
headerItem->setText(GTW_COLUMN_UNREAD, tr("Unread"));
|
headerItem->setText(GTW_COLUMN_UNREAD, "");
|
||||||
headerItem->setText(GTW_COLUMN_POSTS, tr("F Posts"));
|
headerItem->setText(GTW_COLUMN_POSTS, "");
|
||||||
headerItem->setText(GTW_COLUMN_POPULARITY, tr("Popularity"));
|
headerItem->setText(GTW_COLUMN_POPULARITY, "");
|
||||||
headerItem->setText(GTW_COLUMN_LAST_POST, tr("Last Post"));
|
headerItem->setText(GTW_COLUMN_LAST_POST, "");
|
||||||
headerItem->setToolTip(GTW_COLUMN_NAME, tr("Name"));
|
headerItem->setToolTip(GTW_COLUMN_NAME, tr("Group Name"));
|
||||||
headerItem->setToolTip(GTW_COLUMN_UNREAD, tr("Number of Unread message"));
|
headerItem->setToolTip(GTW_COLUMN_UNREAD, tr("Number of Unread message"));
|
||||||
headerItem->setToolTip(GTW_COLUMN_POSTS, tr("Friend's Posts"));
|
headerItem->setToolTip(GTW_COLUMN_POSTS, tr("Friend's Posts"));
|
||||||
headerItem->setToolTip(GTW_COLUMN_POPULARITY, tr("Popularity"));
|
headerItem->setToolTip(GTW_COLUMN_POPULARITY, tr("Popularity"));
|
||||||
@ -109,9 +109,9 @@ GroupTreeWidget::GroupTreeWidget(QWidget *parent) :
|
|||||||
|
|
||||||
/* Set header resize modes and initial section sizes */
|
/* Set header resize modes and initial section sizes */
|
||||||
QHeaderView *header = ui->treeWidget->header ();
|
QHeaderView *header = ui->treeWidget->header ();
|
||||||
header->setStretchLastSection(false);
|
header->setStretchLastSection(true);
|
||||||
QHeaderView_setSectionResizeModeColumn(header, GTW_COLUMN_NAME, QHeaderView::Stretch);
|
QHeaderView_setSectionResizeModeColumn(header, GTW_COLUMN_NAME, QHeaderView::Interactive);
|
||||||
header->resizeSection(GTW_COLUMN_NAME, 10*W) ;
|
header->resizeSection(GTW_COLUMN_NAME, 40*W) ;
|
||||||
QHeaderView_setSectionResizeModeColumn(header, GTW_COLUMN_UNREAD, QHeaderView::Interactive);
|
QHeaderView_setSectionResizeModeColumn(header, GTW_COLUMN_UNREAD, QHeaderView::Interactive);
|
||||||
header->resizeSection(GTW_COLUMN_UNREAD, 3*W+4) ;
|
header->resizeSection(GTW_COLUMN_UNREAD, 3*W+4) ;
|
||||||
QHeaderView_setSectionResizeModeColumn(header, GTW_COLUMN_POSTS, QHeaderView::Interactive);
|
QHeaderView_setSectionResizeModeColumn(header, GTW_COLUMN_POSTS, QHeaderView::Interactive);
|
||||||
@ -191,8 +191,6 @@ void GroupTreeWidget::processSettings(bool load)
|
|||||||
|
|
||||||
if (load) {
|
if (load) {
|
||||||
// load Settings
|
// load Settings
|
||||||
bool showHeader = Settings->value("GroupShowHeader", false).toBool();
|
|
||||||
actionShowHeader->setChecked(showHeader);
|
|
||||||
|
|
||||||
// state of order
|
// state of order
|
||||||
bool ascSort = Settings->value("GroupAscSort", true).toBool();
|
bool ascSort = Settings->value("GroupAscSort", true).toBool();
|
||||||
@ -230,7 +228,6 @@ void GroupTreeWidget::processSettings(bool load)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// save Settings
|
// save Settings
|
||||||
Settings->setValue("GroupShowHeader", !(actionShowHeader && actionShowHeader->isChecked())); //False by default
|
|
||||||
|
|
||||||
// state of order
|
// state of order
|
||||||
Settings->setValue("GroupAscSort", !(actionSortDescending && actionSortDescending->isChecked())); //True by default
|
Settings->setValue("GroupAscSort", !(actionSortDescending && actionSortDescending->isChecked())); //True by default
|
||||||
@ -257,10 +254,6 @@ void GroupTreeWidget::initDisplayMenu(QToolButton *toolButton)
|
|||||||
displayMenu = new QMenu();
|
displayMenu = new QMenu();
|
||||||
QActionGroup *actionGroupAsc = new QActionGroup(displayMenu);
|
QActionGroup *actionGroupAsc = new QActionGroup(displayMenu);
|
||||||
|
|
||||||
actionShowHeader = displayMenu->addAction(tr("Show Header"));
|
|
||||||
connect(actionShowHeader, SIGNAL(toggled(bool)), this, SLOT(showHeader(bool)));
|
|
||||||
actionShowHeader->setCheckable(true);
|
|
||||||
|
|
||||||
actionSortDescending = displayMenu->addAction(FilesDefs::getIconFromQtResourcePath(":/images/sort_decrease.png"), tr("Sort Descending Order"), this, SLOT(sort()));
|
actionSortDescending = displayMenu->addAction(FilesDefs::getIconFromQtResourcePath(":/images/sort_decrease.png"), tr("Sort Descending Order"), this, SLOT(sort()));
|
||||||
actionSortDescending->setCheckable(true);
|
actionSortDescending->setCheckable(true);
|
||||||
actionSortDescending->setActionGroup(actionGroupAsc);
|
actionSortDescending->setActionGroup(actionGroupAsc);
|
||||||
@ -777,11 +770,6 @@ void GroupTreeWidget::distantSearch()
|
|||||||
ui->distantSearchLineEdit->clear();
|
ui->distantSearchLineEdit->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupTreeWidget::showHeader(bool toShow)
|
|
||||||
{
|
|
||||||
ui->treeWidget->header()->setVisible(toShow);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GroupTreeWidget::sort()
|
void GroupTreeWidget::sort()
|
||||||
{
|
{
|
||||||
resort(NULL);
|
resort(NULL);
|
||||||
|
@ -140,7 +140,6 @@ private slots:
|
|||||||
void filterChanged();
|
void filterChanged();
|
||||||
void distantSearch();
|
void distantSearch();
|
||||||
|
|
||||||
void showHeader(bool toShow);
|
|
||||||
void sort();
|
void sort();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -152,7 +151,6 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QMenu *displayMenu;
|
QMenu *displayMenu;
|
||||||
QAction *actionShowHeader;
|
|
||||||
QAction *actionSortAscending;
|
QAction *actionSortAscending;
|
||||||
QAction *actionSortDescending;
|
QAction *actionSortDescending;
|
||||||
QAction *actionSortByName;
|
QAction *actionSortByName;
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -137,7 +137,7 @@
|
|||||||
<customwidget>
|
<customwidget>
|
||||||
<class>LineEditClear</class>
|
<class>LineEditClear</class>
|
||||||
<extends>QLineEdit</extends>
|
<extends>QLineEdit</extends>
|
||||||
<header>gui/common/LineEditClear.h</header>
|
<header location="global">gui/common/LineEditClear.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>RSTreeWidget</class>
|
<class>RSTreeWidget</class>
|
||||||
|
@ -250,7 +250,7 @@ QMenu *RSTreeWidget::createStandardContextMenu(QMenu *contextMenu)
|
|||||||
contextMenu->addSeparator();
|
contextMenu->addSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mContextMenuActions.isEmpty() || mEnableColumnCustomize ||!mContextMenuActions.isEmpty() || !mContextMenuMenus.isEmpty()) {
|
if(!mContextMenuActions.isEmpty() || !mContextMenuMenus.isEmpty() || mEnableColumnCustomize) {
|
||||||
QWidget *widget = new QWidget(contextMenu);
|
QWidget *widget = new QWidget(contextMenu);
|
||||||
widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
|
||||||
|
|
||||||
@ -279,6 +279,10 @@ QMenu *RSTreeWidget::createStandardContextMenu(QMenu *contextMenu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mEnableColumnCustomize) {
|
if (mEnableColumnCustomize) {
|
||||||
|
QAction *actShowHeader = contextMenu->addAction(QIcon(), tr("Show Header"), this, SLOT(headerVisible()));
|
||||||
|
actShowHeader->setCheckable(true);
|
||||||
|
actShowHeader->setChecked(!isHeaderHidden());
|
||||||
|
|
||||||
QMenu *headerMenu = contextMenu->addMenu(QIcon(),tr("Show column..."));
|
QMenu *headerMenu = contextMenu->addMenu(QIcon(),tr("Show column..."));
|
||||||
|
|
||||||
QTreeWidgetItem *item = headerItem();
|
QTreeWidgetItem *item = headerItem();
|
||||||
@ -292,6 +296,8 @@ QMenu *RSTreeWidget::createStandardContextMenu(QMenu *contextMenu)
|
|||||||
QString txt = item->text(column) ;
|
QString txt = item->text(column) ;
|
||||||
if(txt == "")
|
if(txt == "")
|
||||||
txt = item->data(column,Qt::UserRole).toString() ;
|
txt = item->data(column,Qt::UserRole).toString() ;
|
||||||
|
if(txt == "")
|
||||||
|
txt = item->data(column,Qt::ToolTipRole).toString() ;
|
||||||
|
|
||||||
if(txt=="")
|
if(txt=="")
|
||||||
txt = tr("[no title]") ;
|
txt = tr("[no title]") ;
|
||||||
@ -343,6 +349,19 @@ void RSTreeWidget::headerContextMenuRequested(const QPoint &pos)
|
|||||||
delete contextMenu;
|
delete contextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RSTreeWidget::headerVisible()
|
||||||
|
{
|
||||||
|
QAction *action = dynamic_cast<QAction*>(sender());
|
||||||
|
if (!action) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool visible = action->isChecked();
|
||||||
|
setHeaderHidden(!visible);
|
||||||
|
|
||||||
|
emit headerVisibleChanged(visible);
|
||||||
|
}
|
||||||
|
|
||||||
void RSTreeWidget::columnVisible()
|
void RSTreeWidget::columnVisible()
|
||||||
{
|
{
|
||||||
QAction *action = dynamic_cast<QAction*>(sender());
|
QAction *action = dynamic_cast<QAction*>(sender());
|
||||||
|
@ -58,6 +58,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void signalMouseMiddleButtonClicked(QTreeWidgetItem *item);
|
void signalMouseMiddleButtonClicked(QTreeWidgetItem *item);
|
||||||
|
void headerVisibleChanged(bool visible);
|
||||||
void columnVisibleChanged(int column, bool visible);
|
void columnVisibleChanged(int column, bool visible);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -66,6 +67,7 @@ private:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void headerContextMenuRequested(const QPoint &pos);
|
void headerContextMenuRequested(const QPoint &pos);
|
||||||
|
void headerVisible();
|
||||||
void columnVisible();
|
void columnVisible();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
Reference in New Issue
Block a user