Hello!
I'm very new to C++ (learning while writing this app). I do have some experience with QT using pyside2, but i want to write my app in C++.
My current problem is calling one function with connect() AND QTimer::singleShot().
some snippets of my code:
mainwindow.h
private slots: // in MainWindow class
void searchTable(int searchID);
private slots: // in MainWindow class
void searchTable(int searchID);
To copy to clipboard, switch view to plain text mode
mainwindow.cpp
#include "mainwindow.h"
#include "systemdialog.h"
#include "ui_MainWindow.h"
#include "ui_SystemDialog.h"
MainWindow
::MainWindow(QWidget *parent
): ui(new Ui::MainWindow)
{
ui->setupUi(this);
// SEARCH TABLE UPDATE
connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(searchTable(int)));
// LOAD TABLES
QTimer::singleShot(8500,
this,
SLOT(searchTable
(50)));
etc..
}
#include "mainwindow.h"
#include "systemdialog.h"
#include "ui_MainWindow.h"
#include "ui_SystemDialog.h"
MainWindow::MainWindow(QWidget *parent):
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
// SEARCH TABLE UPDATE
connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(searchTable(int)));
// LOAD TABLES
QTimer::singleShot(8500, this, SLOT(searchTable(50)));
etc..
}
To copy to clipboard, switch view to plain text mode
search.cpp
#include "mainwindow.h"
#include "ui_MainWindow.h"
void MainWindow::searchTable(int searchID){
//my code
}
#include "mainwindow.h"
#include "ui_MainWindow.h"
void MainWindow::searchTable(int searchID){
//my code
}
To copy to clipboard, switch view to plain text mode
App works ok and connect() works ok. And if i call function searchTable(50); after connect() also works ok. Only when i want to use connect() and QTimer::singleShot() i get this issue in Qt Creator App Output:
QObject::connect: No such
slot MainWindow
::searchTable(50) in ..
/NewApp
/mainwindow.
cpp:70 QObject::connect: (receiver name
: 'MainWindow')
QObject::connect: No such slot MainWindow::searchTable(50) in ../NewApp/mainwindow.cpp:70
QObject::connect: (receiver name: 'MainWindow')
To copy to clipboard, switch view to plain text mode
So what am i doing wrong?
Bookmarks