mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-19 21:13:12 -07:00
Add basic ToolBar
This commit is contained in:
parent
76bf46613e
commit
661b410db1
2 changed files with 39 additions and 5 deletions
|
@ -18,12 +18,12 @@
|
||||||
#ifndef CHIAKI_MAINWINDOW_H
|
#ifndef CHIAKI_MAINWINDOW_H
|
||||||
#define CHIAKI_MAINWINDOW_H
|
#define CHIAKI_MAINWINDOW_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QMainWindow>
|
||||||
|
|
||||||
class DynamicGridWidget;
|
class DynamicGridWidget;
|
||||||
class ServerItemWidget;
|
class ServerItemWidget;
|
||||||
|
|
||||||
class MainWindow : public QWidget
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -37,6 +37,9 @@ class MainWindow : public QWidget
|
||||||
public slots:
|
public slots:
|
||||||
void ServerItemWidgetSelected();
|
void ServerItemWidgetSelected();
|
||||||
void ServerItemWidgetTriggered();
|
void ServerItemWidgetTriggered();
|
||||||
|
|
||||||
|
void RunDiscovery();
|
||||||
|
void ShowSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //CHIAKI_MAINWINDOW_H
|
#endif //CHIAKI_MAINWINDOW_H
|
||||||
|
|
|
@ -22,11 +22,32 @@
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
|
#include <QToolBar>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
|
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
||||||
{
|
{
|
||||||
|
auto main_widget = new QWidget(this);
|
||||||
auto layout = new QVBoxLayout();
|
auto layout = new QVBoxLayout();
|
||||||
setLayout(layout);
|
main_widget->setLayout(layout);
|
||||||
|
setCentralWidget(main_widget);
|
||||||
|
layout->setMargin(0);
|
||||||
|
|
||||||
|
auto tool_bar = new QToolBar(this);
|
||||||
|
tool_bar->setMovable(false);
|
||||||
|
addToolBar(tool_bar);
|
||||||
|
|
||||||
|
auto discover_action = new QAction(tr("Discover"), this);
|
||||||
|
tool_bar->addAction(discover_action);
|
||||||
|
connect(discover_action, &QAction::triggered, this, &MainWindow::RunDiscovery);
|
||||||
|
|
||||||
|
auto tool_bar_spacer = new QWidget();
|
||||||
|
tool_bar_spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Ignored);
|
||||||
|
tool_bar->addWidget(tool_bar_spacer);
|
||||||
|
|
||||||
|
auto settings_action = new QAction(tr("Settings"), this);
|
||||||
|
tool_bar->addAction(settings_action);
|
||||||
|
connect(settings_action, &QAction::triggered, this, &MainWindow::ShowSettings);
|
||||||
|
|
||||||
auto scroll_area = new QScrollArea(this);
|
auto scroll_area = new QScrollArea(this);
|
||||||
scroll_area->setWidgetResizable(true);
|
scroll_area->setWidgetResizable(true);
|
||||||
|
@ -76,4 +97,14 @@ void MainWindow::ServerItemWidgetTriggered()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO: connect
|
// TODO: connect
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::RunDiscovery()
|
||||||
|
{
|
||||||
|
qDebug() << "TODO: RunDiscovery()";
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ShowSettings()
|
||||||
|
{
|
||||||
|
qDebug() << "TODO: ShowSettings()";
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue