Merge pull request #445 from PhenomRetroShare/Add_MergeDisplayMenuToHeaderContextMenu

Move Display button's menu to Header context menu on FriendList.
This commit is contained in:
Cyril Soler 2016-07-30 15:26:27 +02:00 committed by GitHub
commit 2921d9eac2
2 changed files with 8 additions and 41 deletions

View File

@ -187,8 +187,9 @@ void FriendList::addToolButton(QToolButton *toolButton)
/* Initialize button */
toolButton->setAutoRaise(true);
toolButton->setIconSize(ui->displayButton->iconSize());
toolButton->setFocusPolicy(ui->displayButton->focusPolicy());
float S = QFontMetricsF(ui->filterLineEdit->font()).height() ;
toolButton->setIconSize(QSize(S*1.5,S*1.5));
toolButton->setFocusPolicy(Qt::NoFocus);
ui->titleBarFrame->layout()->addWidget(toolButton);
}
@ -2283,16 +2284,16 @@ void FriendList::addPeerToExpand(const std::string &gpgId)
void FriendList::createDisplayMenu()
{
QMenu *displayMenu = new QMenu(this);
QMenu *displayMenu = new QMenu(tr("Show"), this);
connect(displayMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
displayMenu->addAction(ui->actionHideOfflineFriends);
displayMenu->addAction(ui->actionShowState);
displayMenu->addAction(ui->actionShowGroups);
displayMenu->addAction(ui->actionExportFriendlist);
displayMenu->addAction(ui->actionImportFriendlist);
ui->displayButton->setMenu(displayMenu);
ui->peerTreeWidget->addHeaderContextMenuMenu(displayMenu);
ui->peerTreeWidget->addHeaderContextMenuAction(ui->actionExportFriendlist);
ui->peerTreeWidget->addHeaderContextMenuAction(ui->actionImportFriendlist);
}
void FriendList::updateMenu()

View File

@ -53,38 +53,6 @@
<item>
<widget class="LineEditClear" name="filterLineEdit"/>
</item>
<item>
<widget class="QToolButton" name="displayButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>30</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Display</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/looknfeel.png</normaloff>:/images/looknfeel.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -188,8 +156,6 @@
<header>gui/common/RSTreeWidget.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>
<resources/>
<connections/>
</ui>