Skip to content

Commit

Permalink
Put all central widgets in a splitter
Browse files Browse the repository at this point in the history
  • Loading branch information
RangelReale committed Jul 31, 2018
1 parent aabc5a5 commit f24ad14
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PROJECT(msgui)

set(MSGUI_NUMBER 1)
set(MSGUI_VERSION 0)
set(MSGUI_BUILD_NUMBER 113)
set(MSGUI_BUILD_NUMBER 114)

set (CMAKE_CXX_STANDARD 14)

Expand Down
2 changes: 2 additions & 0 deletions app/include/msgui/Frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class Frame : public QWidget
Frame(msglib::cmd::base::ptr frame, QWidget *parent);

void setFrame(msglib::cmd::base::ptr frame);

QSize sizeHint() const override;
signals:
void showFileAndLine(const QString &fileAndFile);
protected:
Expand Down
12 changes: 11 additions & 1 deletion app/src/Frame.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "msgui/Frame.h"
#include "msgwidget/highlighter/HL_CPP.h"


#include <QBoxLayout>
#include <QLabel>
#include <QFontDatabase>
#include <QFontMetrics>

namespace msgui {

Expand Down Expand Up @@ -33,6 +33,16 @@ Frame::Frame(msglib::cmd::base::ptr frame, QWidget *parent) :
setFrame(frame);
}

QSize Frame::sizeHint() const
{
QSize sh(QWidget::sizeHint());
// default height of 6 lines of text
int fh = fontMetrics().height() * 6;
if (fh > sh.height())
sh.setHeight(fh);
return sh;
}

void Frame::setFrame(msglib::cmd::base::ptr frame)
{
if (frame)
Expand Down
12 changes: 7 additions & 5 deletions app/src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,17 +402,19 @@ void MainWindow::createWidgets()

QSplitter *splitter1 = new QSplitter(root);
splitter1->setOrientation(Qt::Vertical);
splitter1->addWidget(_error);
splitter1->addWidget(_frame);
splitter1->addWidget(_backtrace);
splitter1->addWidget(_editortab);

splitter1->setStretchFactor(0, 3);
splitter1->setStretchFactor(1, 10);
splitter1->setStretchFactor(0, 2);
splitter1->setStretchFactor(1, 2);
splitter1->setStretchFactor(2, 3);
splitter1->setStretchFactor(3, 8);

rootlayout->setSizeConstraint(QLayout::SetMinimumSize);
rootlayout->addLayout(cmdlayout, 1);
rootlayout->addWidget(_error, 2);
rootlayout->addWidget(_frame, 1);
rootlayout->addWidget(splitter1, 13);
rootlayout->addWidget(splitter1, 16);
}


Expand Down

0 comments on commit f24ad14

Please sign in to comment.