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"; qDebugNN << LOGSEC_GUI << "Main window's close event";
} }
void FormMain::showEvent(QShowEvent* event) {
QMainWindow::showEvent(event);
tabWidget()->feedMessageViewer()->normalizeToolbarHeights();
}
void FormMain::hideEvent(QHideEvent* event) { void FormMain::hideEvent(QHideEvent* event) {
QMainWindow::hideEvent(event); QMainWindow::hideEvent(event);

View File

@ -70,6 +70,7 @@ class RSSGUARD_DLLSPEC FormMain : public QMainWindow {
virtual void resizeEvent(QResizeEvent* event); virtual void resizeEvent(QResizeEvent* event);
virtual void changeEvent(QEvent* event); virtual void changeEvent(QEvent* event);
virtual void closeEvent(QCloseEvent* event); virtual void closeEvent(QCloseEvent* event);
virtual void showEvent(QShowEvent* event);
virtual void hideEvent(QHideEvent* event); virtual void hideEvent(QHideEvent* event);
signals: signals:

View File

@ -109,6 +109,13 @@ bool FeedMessageViewer::areListHeadersEnabled() const {
return m_listHeadersEnabled; 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() { void FeedMessageViewer::onFeedSplitterResized() {
qDebugNN << LOGSEC_GUI << "Feed splitter moved."; qDebugNN << LOGSEC_GUI << "Feed splitter moved.";

View File

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

View File

@ -440,6 +440,8 @@ void SettingsGui::saveSettings() {
m_ui->m_editorMessagesToolbar->saveToolBar(); m_ui->m_editorMessagesToolbar->saveToolBar();
m_ui->m_editorStatusbar->saveToolBar(); m_ui->m_editorStatusbar->saveToolBar();
qApp->mainForm()->tabWidget()->feedMessageViewer()->normalizeToolbarHeights();
qApp->mainForm()->tabWidget()->checkTabBarVisibility(); qApp->mainForm()->tabWidget()->checkTabBarVisibility();
qApp->mainForm()->tabWidget()->feedMessageViewer()->refreshVisualProperties(); 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*> available_actions = availableActions();
QList<QAction*> spec_actions; QList<QAction*> spec_actions;
spec_actions.reserve(actions.size());
// Iterate action names and add respectable actions into the toolbar. // Iterate action names and add respectable actions into the toolbar.
for (const QString& action_name : actions) { for (const QString& action_name : actions) {
QAction* matching_action = findMatchingAction(action_name, available_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*> available_actions = availableActions();
QList<QAction*> spec_actions; QList<QAction*> spec_actions;
spec_actions.reserve(actions.size());
// Iterate action names and add respectable actions into the toolbar. // Iterate action names and add respectable actions into the toolbar.
for (const QString& action_name : actions) { for (const QString& action_name : actions) {
auto* matching_action = findMatchingAction(action_name, available_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*> available_actions = availableActions();
QList<QAction*> spec_actions; QList<QAction*> spec_actions;
spec_actions.reserve(actions.size());
// Iterate action names and add respectable // Iterate action names and add respectable
// actions into the toolbar. // actions into the toolbar.
for (const QString& action_name : actions) { for (const QString& action_name : actions) {