add QCanvas Root and viewport pane in gcompose
This commit is contained in:
49
app/gcompose/src/MainPanel.cpp
Normal file
49
app/gcompose/src/MainPanel.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "MainPanel.h"
|
||||
#include "QViewportPane.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QSplitter>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
MainPanel::MainPanel(QWidget* parent) : QWidget(parent) {
|
||||
auto* mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mainLayout->setSpacing(0);
|
||||
|
||||
// 1. Top Menu Panel
|
||||
auto* menuPanel = new QWidget(this);
|
||||
menuPanel->setFixedHeight(36);
|
||||
menuPanel->setStyleSheet("background-color: #2b2b2b; border-bottom: 1px solid #111;");
|
||||
|
||||
auto* menuLayout = new QHBoxLayout(menuPanel);
|
||||
menuLayout->setContentsMargins(10, 0, 10, 0);
|
||||
menuLayout->setSpacing(15);
|
||||
|
||||
auto* logo = new QLabel("G-COMPOSE", menuPanel);
|
||||
logo->setStyleSheet("font-weight: bold; color: #0078d7; font-size: 14px; letter-spacing: 1px;");
|
||||
|
||||
auto* btnOpen = new QPushButton("Open", menuPanel);
|
||||
auto* btnSave = new QPushButton("Save", menuPanel);
|
||||
|
||||
QString btnStyle = "QPushButton { background: transparent; color: #ccc; border: none; padding: 5px 10px; }"
|
||||
"QPushButton:hover { background: #3c3c3c; color: white; border-radius: 4px; }";
|
||||
btnOpen->setStyleSheet(btnStyle);
|
||||
btnSave->setStyleSheet(btnStyle);
|
||||
|
||||
menuLayout->addWidget(logo);
|
||||
menuLayout->addWidget(btnOpen);
|
||||
menuLayout->addWidget(btnSave);
|
||||
menuLayout->addStretch();
|
||||
|
||||
mainLayout->addWidget(menuPanel);
|
||||
|
||||
// 2. Central Splitter Area
|
||||
m_rootSplitter = new QSplitter(Qt::Horizontal, this);
|
||||
m_firstPane = new QViewportPane(m_rootSplitter);
|
||||
m_rootSplitter->addWidget(m_firstPane);
|
||||
|
||||
mainLayout->addWidget(m_rootSplitter, 1);
|
||||
}
|
||||
|
||||
MainPanel::~MainPanel() {}
|
||||
Reference in New Issue
Block a user