diff --git a/include/ChatPage.h b/include/ChatPage.h index f7d2e1a..01f6c5d 100644 --- a/include/ChatPage.h +++ b/include/ChatPage.h @@ -17,6 +17,7 @@ #pragma once +#include #include #include #include @@ -109,17 +110,11 @@ private: QHBoxLayout *topLayout_; Splitter *splitter; - QWidget *sideBar_; + QFrame *sideBar_; QVBoxLayout *sideBarLayout_; - QVBoxLayout *sideBarTopLayout_; - QVBoxLayout *sideBarMainLayout_; - QWidget *sideBarTopWidget_; - QVBoxLayout *sideBarTopWidgetLayout_; - QWidget *content_; + QFrame *content_; QVBoxLayout *contentLayout_; - QHBoxLayout *topBarLayout_; - QVBoxLayout *mainContentLayout_; RoomList *room_list_; TimelineViewManager *view_manager_; diff --git a/src/ChatPage.cc b/src/ChatPage.cc index 884e219..3f9c6fb 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc @@ -61,64 +61,39 @@ ChatPage::ChatPage(QSharedPointer client, QWidget *parent) topLayout_->addWidget(splitter); // SideBar - sideBar_ = new QWidget(this); + sideBar_ = new QFrame(this); sideBar_->setMinimumSize(QSize(ui::sidebar::NormalSize, 0)); sideBarLayout_ = new QVBoxLayout(sideBar_); sideBarLayout_->setSpacing(0); sideBarLayout_->setMargin(0); - sideBarTopLayout_ = new QVBoxLayout(); - sideBarTopLayout_->setSpacing(0); - sideBarTopLayout_->setMargin(0); - sideBarMainLayout_ = new QVBoxLayout(); - sideBarMainLayout_->setSpacing(0); - sideBarMainLayout_->setMargin(0); - sidebarActions_ = new SideBarActions(this); connect( sidebarActions_, &SideBarActions::showSettings, this, &ChatPage::showUserSettingsPage); - sideBarLayout_->addLayout(sideBarTopLayout_); - sideBarLayout_->addLayout(sideBarMainLayout_); - sideBarLayout_->addWidget(sidebarActions_); - - sideBarTopWidget_ = new QWidget(sideBar_); - sideBarTopWidget_->setStyleSheet("background-color: #d6dde3; color: #ebebeb;"); + user_info_widget_ = new UserInfoWidget(sideBar_); + room_list_ = new RoomList(client, sideBar_); - sideBarTopLayout_->addWidget(sideBarTopWidget_); - - sideBarTopWidgetLayout_ = new QVBoxLayout(sideBarTopWidget_); - sideBarTopWidgetLayout_->setSpacing(0); - sideBarTopWidgetLayout_->setMargin(0); + sideBarLayout_->addWidget(user_info_widget_); + sideBarLayout_->addWidget(room_list_); + sideBarLayout_->addWidget(sidebarActions_); // Content - content_ = new QWidget(this); + content_ = new QFrame(this); contentLayout_ = new QVBoxLayout(content_); contentLayout_->setSpacing(0); contentLayout_->setMargin(0); - topBarLayout_ = new QHBoxLayout(); - topBarLayout_->setSpacing(0); - mainContentLayout_ = new QVBoxLayout(); - mainContentLayout_->setSpacing(0); - mainContentLayout_->setMargin(0); + top_bar_ = new TopRoomBar(this); + view_manager_ = new TimelineViewManager(client, this); - contentLayout_->addLayout(topBarLayout_); - contentLayout_->addLayout(mainContentLayout_); + contentLayout_->addWidget(top_bar_); + contentLayout_->addWidget(view_manager_); // Splitter splitter->addWidget(sideBar_); splitter->addWidget(content_); - room_list_ = new RoomList(client, sideBar_); - sideBarMainLayout_->addWidget(room_list_); - - top_bar_ = new TopRoomBar(this); - topBarLayout_->addWidget(top_bar_); - - view_manager_ = new TimelineViewManager(client, this); - mainContentLayout_->addWidget(view_manager_); - text_input_ = new TextInputWidget(this); typingDisplay_ = new TypingDisplay(this); contentLayout_->addWidget(typingDisplay_); @@ -127,9 +102,6 @@ ChatPage::ChatPage(QSharedPointer client, QWidget *parent) typingRefresher_ = new QTimer(this); typingRefresher_->setInterval(TYPING_REFRESH_TIMEOUT); - user_info_widget_ = new UserInfoWidget(sideBarTopWidget_); - sideBarTopWidgetLayout_->addWidget(user_info_widget_); - connect(user_info_widget_, SIGNAL(logout()), client_.data(), SLOT(logout())); connect(client_.data(), SIGNAL(loggedOut()), this, SLOT(logout())); diff --git a/src/RoomList.cc b/src/RoomList.cc index c89e4e6..8f49489 100644 --- a/src/RoomList.cc +++ b/src/RoomList.cc @@ -33,13 +33,6 @@ RoomList::RoomList(QSharedPointer client, QWidget *parent) : QWidget(parent) , client_(client) { - setStyleSheet("QWidget { border: none; }"); - - QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - sizePolicy.setHorizontalStretch(0); - sizePolicy.setVerticalStretch(0); - setSizePolicy(sizePolicy); - topLayout_ = new QVBoxLayout(this); topLayout_->setSpacing(0); topLayout_->setMargin(0); @@ -51,7 +44,7 @@ RoomList::RoomList(QSharedPointer client, QWidget *parent) scrollArea_->setWidgetResizable(true); scrollArea_->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter); - scrollAreaContents_ = new QWidget(); + scrollAreaContents_ = new QWidget(this); contentsLayout_ = new QVBoxLayout(scrollAreaContents_); contentsLayout_->setSpacing(0); diff --git a/src/SideBarActions.cc b/src/SideBarActions.cc index 16579ce..3e74140 100644 --- a/src/SideBarActions.cc +++ b/src/SideBarActions.cc @@ -9,9 +9,6 @@ SideBarActions::SideBarActions(QWidget *parent) { setFixedHeight(conf::sidebarActions::height); - QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - setSizePolicy(sizePolicy); - layout_ = new QHBoxLayout(this); layout_->setMargin(0); diff --git a/src/TimelineViewManager.cc b/src/TimelineViewManager.cc index bf2bee7..37feabb 100644 --- a/src/TimelineViewManager.cc +++ b/src/TimelineViewManager.cc @@ -31,7 +31,7 @@ TimelineViewManager::TimelineViewManager(QSharedPointer client, QW : QStackedWidget(parent) , client_(client) { - setStyleSheet("QWidget { background: #fff; color: #e8e8e8; border: none;}"); + setStyleSheet("border: none;"); connect( client_.data(), &MatrixClient::messageSent, this, &TimelineViewManager::messageSent); diff --git a/src/TopRoomBar.cc b/src/TopRoomBar.cc index 25745e1..7bec888 100644 --- a/src/TopRoomBar.cc +++ b/src/TopRoomBar.cc @@ -33,8 +33,7 @@ TopRoomBar::TopRoomBar(QWidget *parent) , buttonSize_{32} { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - setMinimumSize(QSize(0, 65)); - setStyleSheet("background-color: #fff; color: #171919;"); + setFixedHeight(65); topLayout_ = new QHBoxLayout(); topLayout_->setSpacing(10); diff --git a/src/UserInfoWidget.cc b/src/UserInfoWidget.cc index 2f7dc2e..f5f3db7 100644 --- a/src/UserInfoWidget.cc +++ b/src/UserInfoWidget.cc @@ -33,9 +33,7 @@ UserInfoWidget::UserInfoWidget(QWidget *parent) , logoutDialog_{nullptr} , logoutButtonSize_{20} { - QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); - setSizePolicy(sizePolicy); - setMinimumSize(QSize(0, 65)); + setFixedHeight(65); topLayout_ = new QHBoxLayout(this); topLayout_->setSpacing(0); @@ -140,6 +138,8 @@ UserInfoWidget::resizeEvent(QResizeEvent *event) displayNameLabel_->show(); userIdLabel_->show(); } + + QWidget::resizeEvent(event); } void