Skip to content

Instantly share code, notes, and snippets.

@ynonp
Created July 13, 2013 18:07
Show Gist options
  • Save ynonp/5991618 to your computer and use it in GitHub Desktop.
Save ynonp/5991618 to your computer and use it in GitHub Desktop.
QListWidget itemActivated signal example
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QObject::connect(ui->listWidget, SIGNAL(itemActivated(QListWidgetItem*)),
this, SLOT(changeLabelText(QListWidgetItem*)));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::changeLabelText(QListWidgetItem * item)
{
ui->label->setText(item->text());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment