1 Commits

Author SHA1 Message Date
Alexis Delhaie
257bc67f61 Main window frameless + Switching to MSVC2019 2020-08-28 14:47:21 +02:00
6 changed files with 169 additions and 30 deletions

View File

@@ -7,10 +7,10 @@ CONFIG += c++17
# remove possible other optimization flags
QMAKE_CXXFLAGS_RELEASE -= -O
QMAKE_CXXFLAGS_RELEASE -= -O1
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE *= -O2
# add the desired -O3 if not present
QMAKE_CXXFLAGS_RELEASE *= -O3
# add the desired -O3 if not present, MinGW only
# QMAKE_CXXFLAGS_RELEASE *= -O3
RC_ICONS = icon.ico

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.12.4, 2020-08-10T22:47:23. -->
<!-- Written by QtCreator 4.12.4, 2020-08-28T14:45:30. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@@ -74,17 +74,17 @@
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.0 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.0 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5150.win64_mingw81_kit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.0 MSVC2019 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.0 MSVC2019 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5150.win64_msvc2019_64_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="bool">true</value>
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\robof\OneDrive\Documents\build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\robof\OneDrive\Documents\build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@@ -134,8 +134,8 @@
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="bool">true</value>
<value type="int" key="EnableQmlDebugging">2</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\robof\OneDrive\Documents\build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\robof\OneDrive\Documents\build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@@ -185,8 +185,8 @@
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="bool">true</value>
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\robof\OneDrive\Documents\build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\robof\OneDrive\Documents\build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@@ -320,7 +320,7 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Release</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Release</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>

View File

@@ -6,9 +6,31 @@ MainWindow::MainWindow(QWidget *parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->window_title->setText(this->windowTitle());
this->setWindowFlags(Qt::FramelessWindowHint);
init();
}
void MainWindow::mousePressEvent(QMouseEvent *event) {
m_nMouseClick_X_Coordinate = event->x();
m_nMouseClick_Y_Coordinate = event->y();
}
void MainWindow::mouseMoveEvent(QMouseEvent *event) {
if (isWidgetIsTitleBar()) {
move(event->globalX() - m_nMouseClick_X_Coordinate ,
event->globalY() - m_nMouseClick_Y_Coordinate);
}
}
bool MainWindow::isWidgetIsTitleBar() {
return (m_nMouseClick_X_Coordinate >= xmin &&
m_nMouseClick_X_Coordinate < xmax &&
m_nMouseClick_Y_Coordinate >= ymin &&
m_nMouseClick_Y_Coordinate < ymax);
}
MainWindow::~MainWindow()
{
delete ui;
@@ -33,6 +55,10 @@ void MainWindow::init() {
objectId.insert(ui->wed_button->objectName(), Identifier::wed);
objectId.insert(ui->thu_button->objectName(), Identifier::thu);
objectId.insert(ui->fri_button->objectName(), Identifier::fri);
xmax = ui->window_title->x() + ui->window_title->width();
xmin = ui->window_title->x();
ymax = ui->window_title->x() + ui->window_title->height();
ymin = ui->window_title->y();
connect(ui->aboutButton, &QPushButton::clicked, this, &MainWindow::open_about);
connect(ui->template_settings_button, &QPushButton::clicked, this, &MainWindow::edit_template);
connect(ui->dateEdit, &QDateEdit::dateTimeChanged, this, &MainWindow::compute_week_number);

View File

@@ -7,6 +7,8 @@
#define SAVE_FILE_VERSION 1
#define KEY_SAVE_FILE_VERSION "version"
#include <QMouseEvent>
#include <QGraphicsView>
#include <QJsonArray>
#include <QMainWindow>
#include <QDir>
@@ -59,6 +61,16 @@ private:
QMap<int, Week> weeks;
QMap<QString, Identifier> objectId;
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
int m_nMouseClick_X_Coordinate;
int m_nMouseClick_Y_Coordinate;
int xmax;
int xmin;
int ymax;
int ymin;
inline bool isWidgetIsTitleBar();
public slots:
void compute_week_number(const QDateTime &dt);
void compute_time();

View File

@@ -91,7 +91,7 @@
<string notr="true">font-size: 12px;</string>
</property>
<property name="text">
<string>Version: 1.0.0 (Beta 3)</string>
<string>Version: 1.0.0 (Beta 4)</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
@@ -107,7 +107,7 @@
<string notr="true">font-size: 12px;</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Made with Qt 5.15.0 MinGW 64bit (C++17) (&lt;a href=&quot;https://github.com/alexlegarnd/Chronos&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Source Github&lt;/span&gt;&lt;/a&gt;)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Made with Qt 5.15.0 MSVC2019 64bit (C++17) (&lt;a href=&quot;https://github.com/alexlegarnd/Chronos&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Source Github&lt;/span&gt;&lt;/a&gt;)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QTextEdit" name="textEdit">
@@ -122,6 +122,9 @@
<property name="accessibleDescription">
<string notr="true"/>
</property>
<property name="styleSheet">
<string notr="true">font-size: 12px;</string>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
@@ -132,7 +135,7 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:7.5pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:12px; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Application icon: Alexis Delhaie (me)&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;About box banner: Alexis Delhaie (me)&lt;/span&gt;&lt;/p&gt;

View File

@@ -7,19 +7,19 @@
<x>0</x>
<y>0</y>
<width>1206</width>
<height>649</height>
<height>662</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>1206</width>
<height>649</height>
<height>662</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1206</width>
<height>649</height>
<height>662</height>
</size>
</property>
<property name="font">
@@ -42,7 +42,7 @@
<property name="geometry">
<rect>
<x>192</x>
<y>19</y>
<y>41</y>
<width>20</width>
<height>81</height>
</rect>
@@ -55,7 +55,7 @@
<property name="geometry">
<rect>
<x>236</x>
<y>29</y>
<y>51</y>
<width>151</width>
<height>61</height>
</rect>
@@ -117,7 +117,7 @@ color: white;</string>
<property name="geometry">
<rect>
<x>40</x>
<y>29</y>
<y>51</y>
<width>161</width>
<height>61</height>
</rect>
@@ -179,7 +179,7 @@ color: white;</string>
<property name="geometry">
<rect>
<x>1022</x>
<y>23</y>
<y>45</y>
<width>153</width>
<height>61</height>
</rect>
@@ -258,7 +258,7 @@ color: white;</string>
<property name="geometry">
<rect>
<x>427</x>
<y>30</y>
<y>52</y>
<width>161</width>
<height>61</height>
</rect>
@@ -320,7 +320,7 @@ color: white;</string>
<property name="geometry">
<rect>
<x>378</x>
<y>20</y>
<y>42</y>
<width>20</width>
<height>81</height>
</rect>
@@ -333,7 +333,7 @@ color: white;</string>
<property name="geometry">
<rect>
<x>930</x>
<y>600</y>
<y>622</y>
<width>261</width>
<height>31</height>
</rect>
@@ -346,7 +346,7 @@ color: white;</string>
<property name="geometry">
<rect>
<x>140</x>
<y>160</y>
<y>182</y>
<width>921</width>
<height>391</height>
</rect>
@@ -1341,7 +1341,7 @@ font-size: 22px;</string>
<property name="geometry">
<rect>
<x>20</x>
<y>588</y>
<y>610</y>
<width>44</width>
<height>44</height>
</rect>
@@ -1371,8 +1371,106 @@ font-size: 22px;</string>
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="window_title">
<property name="geometry">
<rect>
<x>10</x>
<y>-1</y>
<width>1081</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<widget class="QPushButton" name="closeButton">
<property name="geometry">
<rect>
<x>1156</x>
<y>0</y>
<width>51</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<family>Segoe MDL2 Assets</family>
<pointsize>-1</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">border: none;
font-size: 14px;</string>
</property>
<property name="text">
<string></string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="minimizeButton">
<property name="geometry">
<rect>
<x>1101</x>
<y>0</y>
<width>51</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<family>Segoe MDL2 Assets</family>
<pointsize>-1</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">border: none;
font-size: 14px;</string>
</property>
<property name="text">
<string></string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
<connections>
<connection>
<sender>closeButton</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>1186</x>
<y>10</y>
</hint>
<hint type="destinationlabel">
<x>602</x>
<y>330</y>
</hint>
</hints>
</connection>
<connection>
<sender>minimizeButton</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>showMinimized()</slot>
<hints>
<hint type="sourcelabel">
<x>1126</x>
<y>15</y>
</hint>
<hint type="destinationlabel">
<x>602</x>
<y>330</y>
</hint>
</hints>
</connection>
</connections>
</ui>