Device Emulation (contd.): Hide Device Detail view when Escape pressed or Refresh clicked
This commit is contained in:
parent
7561b09c1e
commit
26ceb2f9df
@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|||||||
#include "portgrouplist.h"
|
#include "portgrouplist.h"
|
||||||
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
DevicesWidget::DevicesWidget(QWidget *parent)
|
DevicesWidget::DevicesWidget(QWidget *parent)
|
||||||
: QWidget(parent), portGroups_(NULL)
|
: QWidget(parent), portGroups_(NULL)
|
||||||
@ -87,6 +88,16 @@ void DevicesWidget::setPortGroupList(PortGroupList *portGroups)
|
|||||||
updateDeviceViewActions();
|
updateDeviceViewActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DevicesWidget::keyPressEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
if (event->key() == Qt::Key_Escape) {
|
||||||
|
deviceDetail->hide();
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
|
|
||||||
void DevicesWidget::setCurrentPortIndex(const QModelIndex &portIndex)
|
void DevicesWidget::setCurrentPortIndex(const QModelIndex &portIndex)
|
||||||
{
|
{
|
||||||
Port *port = NULL;
|
Port *port = NULL;
|
||||||
@ -220,6 +231,7 @@ void DevicesWidget::on_refresh_clicked()
|
|||||||
Q_ASSERT(curPortGroup.isValid());
|
Q_ASSERT(curPortGroup.isValid());
|
||||||
Q_ASSERT(portGroups_->isPortGroup(curPortGroup));
|
Q_ASSERT(portGroups_->isPortGroup(curPortGroup));
|
||||||
|
|
||||||
|
deviceDetail->hide();
|
||||||
portGroups_->portGroup(curPortGroup)
|
portGroups_->portGroup(curPortGroup)
|
||||||
.getDeviceInfo(portGroups_->port(currentPortIndex_).id());
|
.getDeviceInfo(portGroups_->port(currentPortIndex_).id());
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,8 @@ public:
|
|||||||
DevicesWidget(QWidget *parent = NULL);
|
DevicesWidget(QWidget *parent = NULL);
|
||||||
void setPortGroupList(PortGroupList *portGroups);
|
void setPortGroupList(PortGroupList *portGroups);
|
||||||
|
|
||||||
|
virtual void keyPressEvent(QKeyEvent *event);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setCurrentPortIndex(const QModelIndex &portIndex);
|
void setCurrentPortIndex(const QModelIndex &portIndex);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user