QObject::setParent: Cannot set parent, new parent is in a different thread
QWidget::repaint: Recursive repaint detected
QObject::setParent: Cannot set parent, new parent is in a different thread
QBackingStore::endPaint() called with active painter; did you forget to destroy it or call QPainter::end() on it?
auto callback = [](PWLAN_NOTIFICATION_DATA data, void *pointer) {
if (data != NULL && data -> NotificationSource == WLAN_NOTIFICATION_SOURCE_ACM) {
if (data -> NotificationCode==wlan_notification_acm_disconnected) {
QMessageBox::warning(reinterpret_cast<RExaminationMain*>(pointer), "WIFI", "WIFI отключился");
}
}
};
int code = wifi->RegisterCallback(callback,(void*)this); //OnNotificationCallback
int WifiManager::RegisterCallback(void (*callback)(PWLAN_NOTIFICATION_DATA, PVOID),void* context){
dwResult = WlanRegisterNotification(
hClient,
WLAN_NOTIFICATION_SOURCE_ACM,
TRUE,
callback, //WLAN_NOTIFICATION_CALLBACK
context,
NULL,
NULL);
if (dwResult!=ERROR_SUCCESS){
return WIFI_CALLBACK_ERROR;
}
return WIFI_NO_ERROR;
}
//Внутри класса RExaminationMain:
auto callback = [](auto, void *data) {
QMessageBox::warning(reinterpret_cast<RExaminationMain*>(data), "WIFI", "WIFI отключился");
};
wifi->RegisterCallback(callback);
int WifiManager::RegisterCallback(void (*callback)(PWLAN_NOTIFICATION_DATA, PVOID)){
dwResult = WlanRegisterNotification(
hClient,
WLAN_NOTIFICATION_SOURCE_ACM,
TRUE,
WLAN_NOTIFICATION_CALLBACK(callback),
NULL,
NULL,
NULL);
if (dwResult!=ERROR_SUCCESS){
return WIFI_CALLBACK_ERROR;
}
return WIFI_NO_ERROR;
}
func (device Device) execute(command string) ([]byte, error) {
text:=fmt.Sprintf("{\"command\": \"%s\"}",command)
s, err := net.DialTimeout("tcp", device.ip+":"+device.port,300*time.Millisecond)
if err!= nil {
return []byte{}, err
}
defer s.Close()
fmt.Fprintf(s, text)
buf,err:=ioutil.ReadAll(s)
if err!=nil{
return []byte{}, err
}
return buf, nil
}
func (device *Device) getStats() ([]byte, error) {
return device.execute("command");
}
RNewExaminationWindow newExamination = new RNewExaminationWindow(this);
class RNewExaminationWindow : public QDialog{
Q_OBJECT
public:
RNewExaminationWindow(QWidget* p);
~RNewExaminationWindow();
};
// examination_screen.cpp:
class ExaminationScreen{
.....
filters = new RFilters(this);
filters->setGeometry(...)
};
// examination_screen.h:
#include "RFilters.h"
//RFilters.h
class RFilters{
//....
};
class RFiltersMain{
//....
};
//RFilters.cpp
class ExaminationScreen;
RFilters::RFilters(QWidget* parent){
main=RFiltersMain(parent);
}
RFiltersMain::RFiltersMain(QWidget* parent){
parent = (ExaminationScreen*) parent;
parent->obj.doSomething();
}
Там как будто просто неоткуда браться даже мегабайту.
Да, это windows specific, точнее MSVC specific.
Вообще у меня все через Cmake, здесь просто для удобства экспериментов вынес в файл