#include "panelSelectionDialog.h" #include "ui_panelSelectionDialog.h" PanelSelectionDialog::PanelSelectionDialog(QWidget *parent) : QDialog(parent) , ui(new Ui::panelSelectionDialog) { ui->setupUi(this); setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog); setAttribute(Qt::WA_TranslucentBackground); if(ui->listWidget->count() > 0) ui->listWidget->setCurrentRow(0); connect(ui->btnConfirm, SIGNAL(clicked()), this, SLOT(onBtnClicked_confirm())); connect(ui->btnCancle, SIGNAL(clicked()), this, SLOT(onBtnClicked_cancle())); } PanelSelectionDialog::~PanelSelectionDialog() { delete ui; } // void PanelSelectionDialog::showEvent(QShowEvent* event) // { // Q_UNUSED(event); // ui->listWidget->clearSelection(); // QDialog::showEvent(event); // } void PanelSelectionDialog::onBtnClicked_confirm() { QListWidgetItem* item = ui->listWidget->currentItem(); if(item) { QString strType = item->text(); ui->listWidget->setCurrentRow(0); hide(); emit panelType(strType); } } void PanelSelectionDialog::onBtnClicked_cancle() { hide(); emit sgl_hide(); //ui->listWidget->clearSelection(); }