I am working on signal and slots.
here is the mainwindow.h
....
public slots:
void slotChangeName();
....
mainwindow.cpp;
#include<globals.h>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
QObject::connect(project_created,SIGNAL(selectionChanged()),this,SLOT(slotChangeName()))
}
void MainWindow::slotChangeName()
{
ui->project_name->setText(project_directory);
}
When a project created, the global variable, "project_created",is updated as 1. I want to write the project directory on the label when "project_created" updated. What do I have to do?
globals.h
#ifndef GLOBALS_H
#define GLOBALS_H
class QString;
extern int project_created;
extern QString project_directory;
#endif
globals.cpp
#include "globals.h"
#include <QString>
// ALL THE GLOBAL DEFINITIONS
int project_created = 0;
QString project_directory = "";
When people clicked to the new project, they can create a project folder. After that the project_created updated as 1. I want to write the project name nnext to the yellow folder icon.