normalize heights of feeds/articles toolbar when main windows is shown

This commit is contained in:
Martin Rotter 2023-11-02 07:34:39 +01:00
parent b18b6424a7
commit 24cbeb9491
8 changed files with 28 additions and 4 deletions

View File

@ -1090,6 +1090,12 @@ void FormMain::closeEvent(QCloseEvent* event) {
qDebugNN << LOGSEC_GUI << "Main window's close event";
}
void FormMain::showEvent(QShowEvent* event) {
QMainWindow::showEvent(event);
tabWidget()->feedMessageViewer()->normalizeToolbarHeights();
}
void FormMain::hideEvent(QHideEvent* event) {
QMainWindow::hideEvent(event);

View File

@ -11,11 +11,11 @@ class StatusBar;
class QWidgetAction;
class RSSGUARD_DLLSPEC FormMain : public QMainWindow {
Q_OBJECT
Q_OBJECT
friend class TabWidget;
friend class MessagesView;
friend class FeedsView;
friend class TabWidget;
friend class MessagesView;
friend class FeedsView;
public:
explicit FormMain(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowType::Widget);
@ -70,6 +70,7 @@ class RSSGUARD_DLLSPEC FormMain : public QMainWindow {
virtual void resizeEvent(QResizeEvent* event);
virtual void changeEvent(QEvent* event);
virtual void closeEvent(QCloseEvent* event);
virtual void showEvent(QShowEvent* event);
virtual void hideEvent(QHideEvent* event);
signals:

View File

@ -109,6 +109,13 @@ bool FeedMessageViewer::areListHeadersEnabled() const {
return m_listHeadersEnabled;
}
void FeedMessageViewer::normalizeToolbarHeights() {
auto max_height = std::max(m_toolBarFeeds->height(), m_toolBarMessages->height());
m_toolBarFeeds->setMinimumHeight(max_height);
m_toolBarMessages->setMinimumHeight(max_height);
}
void FeedMessageViewer::onFeedSplitterResized() {
qDebugNN << LOGSEC_GUI << "Feed splitter moved.";

View File

@ -38,6 +38,8 @@ class RSSGUARD_DLLSPEC FeedMessageViewer : public TabContent {
bool areToolBarsEnabled() const;
bool areListHeadersEnabled() const;
void normalizeToolbarHeights();
public slots:
void saveSize();
void loadSize();

View File

@ -440,6 +440,8 @@ void SettingsGui::saveSettings() {
m_ui->m_editorMessagesToolbar->saveToolBar();
m_ui->m_editorStatusbar->saveToolBar();
qApp->mainForm()->tabWidget()->feedMessageViewer()->normalizeToolbarHeights();
qApp->mainForm()->tabWidget()->checkTabBarVisibility();
qApp->mainForm()->tabWidget()->feedMessageViewer()->refreshVisualProperties();

View File

@ -44,6 +44,8 @@ QList<QAction*> FeedsToolBar::convertActions(const QStringList& actions) {
QList<QAction*> available_actions = availableActions();
QList<QAction*> spec_actions;
spec_actions.reserve(actions.size());
// Iterate action names and add respectable actions into the toolbar.
for (const QString& action_name : actions) {
QAction* matching_action = findMatchingAction(action_name, available_actions);

View File

@ -50,6 +50,8 @@ QList<QAction*> MessagesToolBar::convertActions(const QStringList& actions) {
QList<QAction*> available_actions = availableActions();
QList<QAction*> spec_actions;
spec_actions.reserve(actions.size());
// Iterate action names and add respectable actions into the toolbar.
for (const QString& action_name : actions) {
auto* matching_action = findMatchingAction(action_name, available_actions);

View File

@ -90,6 +90,8 @@ QList<QAction*> StatusBar::convertActions(const QStringList& actions) {
QList<QAction*> available_actions = availableActions();
QList<QAction*> spec_actions;
spec_actions.reserve(actions.size());
// Iterate action names and add respectable
// actions into the toolbar.
for (const QString& action_name : actions) {