Changeset - cb28b6958b0e
[Not reviewed]
default
0 4 1
Hasan Yavuz ÖZDERYA - 10 years ago 2015-04-18 10:24:29
hy@ozderya.net
added about dialog
5 files changed with 113 insertions and 2 deletions:
0 comments (0 inline, 0 general)
CMakeLists.txt
Show inline comments
 
@@ -38,7 +38,7 @@ find_package(Qwt 6.1 REQUIRED)
 
include_directories(${QWT_INCLUDE_DIR})
 

	
 
# wrap UI files
 
qt5_wrap_ui(UI_FILES mainwindow.ui)
 
qt5_wrap_ui(UI_FILES mainwindow.ui about_dialog.ui)
 

	
 
# Tell CMake to create the helloworld executable
 
add_executable(serialplot main.cpp mainwindow.cpp customcheckablebutton.cpp ${UI_FILES})
about_dialog.ui
Show inline comments
 
new file 100644
 
<?xml version="1.0" encoding="UTF-8"?>
 
<ui version="4.0">
 
 <class>AboutDialog</class>
 
 <widget class="QDialog" name="AboutDialog">
 
  <property name="geometry">
 
   <rect>
 
    <x>0</x>
 
    <y>0</y>
 
    <width>487</width>
 
    <height>300</height>
 
   </rect>
 
  </property>
 
  <property name="windowTitle">
 
   <string>About</string>
 
  </property>
 
  <layout class="QVBoxLayout" name="verticalLayout">
 
   <item>
 
    <widget class="QLabel" name="label">
 
     <property name="text">
 
      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;SerialPlot&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;v0.1&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Developed by Hasan Yavuz Özderya&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Using Qt and Qwt (&lt;a href=&quot;http://qwt.sf.net&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://qwt.sf.net&lt;/span&gt;&lt;/a&gt;)&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;This software is GPL licensed. You can obtain source code from &lt;a href=&quot;https://bitbucket.org/hyOzd/serialplot&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://bitbucket.org/hyOzd/serialplot&lt;/span&gt;&lt;/a&gt;.&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
 
     </property>
 
     <property name="wordWrap">
 
      <bool>true</bool>
 
     </property>
 
     <property name="openExternalLinks">
 
      <bool>true</bool>
 
     </property>
 
    </widget>
 
   </item>
 
   <item>
 
    <layout class="QHBoxLayout" name="horizontalLayout">
 
     <item>
 
      <widget class="QPushButton" name="pbAboutQt">
 
       <property name="text">
 
        <string>About Qt</string>
 
       </property>
 
      </widget>
 
     </item>
 
     <item>
 
      <widget class="QDialogButtonBox" name="buttonBox">
 
       <property name="orientation">
 
        <enum>Qt::Horizontal</enum>
 
       </property>
 
       <property name="standardButtons">
 
        <set>QDialogButtonBox::Close</set>
 
       </property>
 
      </widget>
 
     </item>
 
    </layout>
 
   </item>
 
  </layout>
 
 </widget>
 
 <resources/>
 
 <connections>
 
  <connection>
 
   <sender>buttonBox</sender>
 
   <signal>accepted()</signal>
 
   <receiver>AboutDialog</receiver>
 
   <slot>accept()</slot>
 
   <hints>
 
    <hint type="sourcelabel">
 
     <x>248</x>
 
     <y>254</y>
 
    </hint>
 
    <hint type="destinationlabel">
 
     <x>157</x>
 
     <y>274</y>
 
    </hint>
 
   </hints>
 
  </connection>
 
  <connection>
 
   <sender>buttonBox</sender>
 
   <signal>rejected()</signal>
 
   <receiver>AboutDialog</receiver>
 
   <slot>reject()</slot>
 
   <hints>
 
    <hint type="sourcelabel">
 
     <x>316</x>
 
     <y>260</y>
 
    </hint>
 
    <hint type="destinationlabel">
 
     <x>286</x>
 
     <y>274</y>
 
    </hint>
 
   </hints>
 
  </connection>
 
 </connections>
 
</ui>
mainwindow.cpp
Show inline comments
 
@@ -20,6 +20,7 @@
 
#include "mainwindow.h"
 
#include "ui_mainwindow.h"
 
#include <QSerialPortInfo>
 
#include <QApplication>
 
#include <QtDebug>
 
#include <qwt_plot.h>
 
#include <limits.h>
 
@@ -30,8 +31,15 @@ MainWindow::MainWindow(QWidget *parent) 
 
    ui(new Ui::MainWindow)
 
{
 
    ui->setupUi(this);
 
    setupAboutDialog();
 

	
 
    // init UI signals
 

	
 
    // menu signals
 
    QObject::connect(ui->actionHelpAbout, &QAction::triggered,
 
              &aboutDialog, &QWidget::show);
 

	
 
    // port tab signals
 
    QObject::connect(ui->pbReloadPorts, &QPushButton::clicked,
 
                     this, &MainWindow::loadPortList);
 

	
 
@@ -168,6 +176,15 @@ MainWindow::~MainWindow()
 
    delete ui;
 
}
 

	
 
void MainWindow::setupAboutDialog()
 
{
 
    Ui_AboutDialog uiAboutDialog;
 
    uiAboutDialog.setupUi(&aboutDialog);
 

	
 
    QObject::connect(uiAboutDialog.pbAboutQt, &QPushButton::clicked,
 
                     [](){ QApplication::aboutQt();});
 
}
 

	
 
void MainWindow::loadPortList()
 
{
 
    QString currentSelection = ui->cbPortList->currentText();
mainwindow.h
Show inline comments
 
@@ -28,6 +28,8 @@
 
#include <QSignalMapper>
 
#include <qwt_plot_curve.h>
 

	
 
#include "ui_about_dialog.h"
 

	
 
namespace Ui {
 
class MainWindow;
 
}
 
@@ -58,6 +60,9 @@ private:
 
    QButtonGroup stopBitsButtons;
 
    QButtonGroup flowControlButtons;
 

	
 
    QDialog aboutDialog;
 
    void setupAboutDialog();
 

	
 
    QSerialPort serialPort;
 

	
 
    unsigned int numOfSamples;
serialplot.pro
Show inline comments
 
@@ -41,6 +41,7 @@ HEADERS  += mainwindow.h \
 
    utils.h \
 
    customcheckablebutton.h
 

	
 
FORMS    += mainwindow.ui
 
FORMS    += mainwindow.ui \
 
    about_dialog.ui
 

	
 
CONFIG += c++11
0 comments (0 inline, 0 general)