Changeset - 160b17420197
[Not reviewed]
default
0 3 0
Hasan Yavuz ÖZDERYA - 9 years ago 2016-08-12 16:27:10
hy@ozderya.net
added reload port list button to toolbar
3 files changed with 11 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/portcontrol.cpp
Show inline comments
 
@@ -32,20 +32,26 @@ PortControl::PortControl(QSerialPort* po
 
    QWidget(parent),
 
    ui(new Ui::PortControl),
 
    portToolBar("Port Toolbar"),
 
    openAction("Open", this)
 
    openAction("Open", this),
 
    loadPortListAction("↺", this)
 
{
 
    ui->setupUi(this);
 

	
 
    serialPort = port;
 

	
 
    // setup the toolbar
 
    // setup actions
 
    openAction.setCheckable(true);
 
    openAction.setShortcut(QKeySequence("F12"));
 
    openAction.setToolTip("Open Port");
 
    QObject::connect(&openAction, &QAction::triggered,
 
                     this, &PortControl::openActionTriggered);
 

	
 
    QObject::connect(&loadPortListAction, &QAction::triggered,
 
                     [this](bool checked){loadPortList();});
 

	
 
    // setup toolbar
 
    portToolBar.addWidget(&tbPortList);
 
    portToolBar.addAction(&loadPortListAction);
 
    portToolBar.addAction(&openAction);
 

	
 
    // setup port selection widgets
 
@@ -66,10 +72,8 @@ PortControl::PortControl(QSerialPort* po
 
                     this, &PortControl::selectPort);
 

	
 
    // setup buttons
 
    QObject::connect(ui->pbReloadPorts, &QPushButton::clicked,
 
                     this, &PortControl::loadPortList);
 

	
 
    ui->pbOpenPort->setDefaultAction(&openAction);
 
    ui->pbReloadPorts->setDefaultAction(&loadPortListAction);
 

	
 
    // setup baud rate selection widget
 
    QObject::connect(ui->cbBaudRate,
src/portcontrol.h
Show inline comments
 
@@ -56,6 +56,7 @@ private:
 

	
 
    QToolBar portToolBar;
 
    QAction openAction;
 
    QAction loadPortListAction;
 
    QComboBox tbPortList;
 
    PortList portList;
 

	
src/portcontrol.ui
Show inline comments
 
@@ -56,7 +56,7 @@
 
        </widget>
 
       </item>
 
       <item row="0" column="2">
 
        <widget class="QPushButton" name="pbReloadPorts">
 
        <widget class="QToolButton" name="pbReloadPorts">
 
         <property name="sizePolicy">
 
          <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
 
           <horstretch>0</horstretch>
0 comments (0 inline, 0 general)