Skip to content

Commit

Permalink
Add emphasized color border to the activated session in split screen …
Browse files Browse the repository at this point in the history
…mode

Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn>
  • Loading branch information
QQxiaoming committed Aug 7, 2024
1 parent f69c1f0 commit 91e983c
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 83 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ en-US:
- Add Python scripting engine for scripting feature [#31](https://github.com/QQxiaoming/quardCRT/pull/31)
- Add the feature of selecting end-of-line sequence
- Add logging information to the status bar
- Add emphasized color border to the activated session in split screen mode
- Fix the issue that clicking the new tab button in split screen mode may not create the session correctly or be located under the wrong tab group

zh-CN:

- 为脚本功能添加Python脚本引擎 [#31](https://github.com/QQxiaoming/quardCRT/pull/31)
- 增加选择行尾序列功能
- 增加状态栏日志信息
- 分屏模式下激活的会话增加强调色边框
- 修复分屏模式下某些情况点击新标签按钮会话未正确创建或位于错误的标签页组下

## [[V0.4.8](https://github.com/QQxiaoming/quardCRT/releases/tag/V0.4.8)] - 2024-07-26

Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- Add Python scripting engine for scripting feature [#31](https://github.com/QQxiaoming/quardCRT/pull/31)
- Add the feature of selecting end-of-line sequence
- Add logging information to the status bar
- Add emphasized color border to the activated session in split screen mode
- Fix the issue that clicking the new tab button in split screen mode may not create the session correctly or be located under the wrong tab group

## [[V0.4.8](https://github.com/QQxiaoming/quardCRT/releases/tag/V0.4.8)] - 2024-07-26

Expand Down
27 changes: 25 additions & 2 deletions src/mainwidgetgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <QWidget>
#include <QPainter>

#include "mainwidgetgroup.h"
#include "sessionswindow.h"

MainWidgetGroup::MainWidgetGroup(Type type, QWidget *parent)
: QObject(parent), m_type(type)
: QWidget(parent), m_type(type)
{
splitter = new QSplitter(Qt::Vertical, parent);
splitter = new QSplitter(Qt::Vertical,parent);
sessionTab = new SessionTab(parent);
QWidget *widget = new QWidget(parent);
widget->setLayout(new QVBoxLayout(widget));
Expand All @@ -39,9 +40,31 @@ MainWidgetGroup::MainWidgetGroup(Type type, QWidget *parent)
splitter->setCollapsible(0,false);
splitter->setCollapsible(1,true);
splitter->setSizes(QList<int>() << 1 << 0);

QVBoxLayout *layout = new QVBoxLayout(this);
setLayout(layout);
layout->setContentsMargins(2,2,2,2);
layout->setSpacing(0);
layout->addWidget(splitter);
}

MainWidgetGroup::~MainWidgetGroup()
{
}

void MainWidgetGroup::setActive(bool enable) {
hasActive = enable;
update();
}

void MainWidgetGroup::paintEvent(QPaintEvent *event) {
if (hasActive) {
QPalette palette;
QPainter painter(this);
painter.setPen(palette.color(QPalette::Active, QPalette::Highlight));
QRect rect = contentsRect();
rect.adjust(1, 1, -1, -1);
painter.drawRect(rect);
}
QWidget::paintEvent(event);
}
10 changes: 7 additions & 3 deletions src/mainwidgetgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
#ifndef MAINWIDGETGROUP_H
#define MAINWIDGETGROUP_H

#include <QObject>
#include <QSplitter>
#include <QPaintEvent>
#include "commandwidget.h"
#include "sessiontab.h"

class MainWidgetGroup: public QObject
class MainWidgetGroup: public QWidget
{
Q_OBJECT
public:
Expand All @@ -35,14 +35,18 @@ class MainWidgetGroup: public QObject
};
MainWidgetGroup(Type type, QWidget *parent = nullptr);
~MainWidgetGroup();

void setActive(bool enable);
Type type() const { return m_type; }

protected:
void paintEvent(QPaintEvent *event) override;

public:
QSplitter *splitter;
SessionTab *sessionTab;
CommandWidget *commandWidget;
Type m_type;
bool hasActive = false;
};

#endif // MAINWIDGETGROUP_H
Loading

0 comments on commit 91e983c

Please sign in to comment.