Controlling Windows Media Player 12 with Qt / ActiveQt - c++

I am trying to embed a movie in a Qt (4.7.1) widget using ActiveQt:
VideoManager2.h:
#ifndef VIDEOMANAGER2_H_
#define VIDEOMANAGER2_H_
#include <QtCore/QtCore>
#include <QtGui/QtGui>
#include "qaxwidget.h"
class VideoManager2: public QWidget{
Q_OBJECT
//Q_ENUMS(ReadyStateConstants);
enum PlayStateConstants { Stopped = 0, Paused = 1, Playing = 2 };
enum ReadyStateConstants { Uninitialized = 0, Loading = 1, Interactive = 3, Complete = 4 };
QAxWidget *wmp;
private slots:
void onPlayStateChange(int a, int b);
void onReadyStateChange(ReadyStateConstants readyState);
public:
VideoManager2();
};
#endif /* VIDEOMANAGER2_H_ */
VideoManager2.cpp:
#include <QtCore/QtCore>
#include <QtGui/QtGui>
#include <InitGuid.h>
#include "VideoManager2.h"
#include "wmp.h"
#include "qaxobject.h"
VideoManager2::VideoManager2() {
wmp = new QAxWidget(this);
wmp->setControl("{6BF52A52-394A-11D3-B153-00C04F79FAA6}");
wmp->setProperty("ShowControls", false);
wmp->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
wmp->setProperty("URL", "C:/Users/qxf3567/Downloads/demoMedia/movie/earth.avi");
qDebug("Version Info: %s", qPrintable(wmp->property("versionInfo").toString()));
qDebug("Playing: %s", qPrintable(wmp->property("URL").toString()));
qDebug("State: %s", qPrintable(wmp->property("playState").toString()));
QAxObject* currentMedia= wmp->querySubObject("currentMedia");
IWMPMedia *media;
currentMedia->queryInterface(QUuid(__uuidof(IWMPMedia)), (void **)&media);
{
BSTR durationStr;
media->get_durationString(&durationStr);
QString convertedBSTR((QChar*) durationStr, wcslen(durationStr));
qDebug("Duration: %s", qPrintable(QString(convertedBSTR)));
}
}
void VideoManager2::onPlayStateChange(int a, int b){
}
void VideoManager2::onReadyStateChange(ReadyStateConstants readyState){
}
main.cpp:
...
QScrollArea *movieWidget = new QScrollArea(groupBox_2);
VideoManager2 vm;
ui->movieWidget->setWidget(&vm);
...
Output:
Version Info: 12.0.7601.18741
Playing: C:\Users\qxf3567\Downloads\demoMedia\movie\earth.avi
State: 9
Duration: 00:00
I can get the Version number of WMPlayer, but the movie to be played is displayed as 0 length. What could be the problem here? It's as if it doensn't find the file in the first place?!

Related

Qt WiFi network scan

For some application I need to scan WiFi searching for available network (SSID). On Ubuntu 18.04 LTS I don't have any issue with the fallowing code. It return all available SSID as expected but when running on Raspbian stretch (Rasberry PI 3 b) the fallowing code is returning the interface wlan0 and eth0 and not the SSID. Does someone have any clue why? or can tell me what I miss? On the other hand, is it better not to use Qt network lib and use a QProcess and parse what sudo iwlist wlan0 scan is returning?
.cpp
void wificonfig::findavailableWifinetwork( void )
{
QNetworkConfigurationManager ncm;
netconflist = ncm.allConfigurations(QNetworkConfiguration::Discovered); //
int i =0;
awifilist.clear();
for(auto &x : netconflist){
if ((x.bearerType() == QNetworkConfiguration::BearerWLAN) ){
if(x.name() == "")
awifilist << "Unknown(Other Network)";
else{
ui->wificonnection_tw->setItem(i, 0, new QTableWidgetItem(x.name()));
i++;
}
//qDebug() << x.type();
}
}
ui->wificonnection_tw->setRowCount(i);
}
.h
#ifndef WIFICONFIG_H
#define WIFICONFIG_H
#include <QList>
#include <QTimer>
#include <QDialog>
#include <QNetworkConfiguration>
#include <QNetworkConfigurationManager>
#include <QNetworkSession>
namespace Ui {
class wificonfig;
}
class wificonfig : public QDialog
{
Q_OBJECT
public:
explicit wificonfig(QWidget *parent = 0);
~wificonfig();
int connection_count;
QNetworkConfiguration netconf;
QStringList awifilist;
QList<QNetworkConfiguration>netconflist;
public slots:
void findavailableWifinetwork( void );
private slots:
void on_wifi_scan_butt_clicked();
private:
Ui::wificonfig *ui;
QTime *scan_timeout_timer;
QNetworkSession *session;
};
#endif // WIFICONFIG_H

Library using another library

I'm writing library for smart home arduino DIY project.
i want to use another library(not written by me).
here is the code:
boiler.cpp
#include "Boiler.h"
Boiler::Boiler(int pin)
{
_pin = pin;
dev.setDevice(_pin); // Set Device Output (on/off)
turnOff();
}
boiler.h
#ifndef BOILER_H_
#define BOILER_H_
// include RF24 libs
#include "RF24.h"
#include "RF24Network.h"
#include "RF24Mesh.h"
#include <SPI.h>
// SmartHome Lib Includes
#include "Device.h"
#include "TimerOne.h"
#include "timeSet.h"
class Boiler
{
private:
RF24 radio(7, 8);
RF24Network network(radio);
RF24Mesh mesh(radio, network);
int _pin ;
void timerIsr();
void DrawSCR();
public:
.
.
.
Boiler (int pin );
void turnOn();
void turnOff();
};
The problem is it's not compiling
the error I get is :
Boiler.h: 32:14: error: expected identifier before numeric constant
RF24 radio(7, 8)
What am i doing wrong?
Thanks,
I Have found the answer (by mistake)
i have added the includes to Boiler.cpp file
and moved the
RF24 radio(7, 8); // Init RF24 Radio
RF24Network network(radio); // Init RF24 Network
RF24Mesh mesh(radio, network); // Init RF24 Mesh
this is the new code :
#include "RF24.h"
#include "RF24Network.h"
#include "RF24Mesh.h"
#include <SPI.h>
.
.
.
#include "Boiler.h"
RF24 radio(7, 8); // Init RF24 Radio
RF24Network network(radio); // Init RF24 Network
RF24Mesh mesh(radio, network); // Init RF24 Mesh
Boiler::Boiler(int pin ,float Rev , String Last )
{
_pin = pin;
dev.setDevice(_pin); // Set Device Output (on/off)
turnOff();
}
void Boiler::init( char nodeID)
{
_nodeID = nodeID;
// Connect to the mesh and set Node ID
mesh.setNodeID(_nodeID);
if (_DEBUG) Serial.println(F("Connecting to the mesh..."));
mesh.begin();
// init LCD and print init data on LCD
myGLCD.InitLCD(60); // Init LCD 55 contrast
myGLCD.setFont(SmallFont); // Set small font
myGLCD.clrScr(); // clr screen
myGLCD.print("Boiler Device",0,0); //Print init Data on screen
myGLCD.print("Rev :" , 0 , 10);
myGLCD.printNumF(_rev,1 ,35,10,'.',1,'0');
myGLCD.print(_last,0,40);
myGLCD.update(); // Update display
turnOff();
}
and now it compiles ;-)

QML custom item state does not change when binded variable changes on C++ state

I have following custom QML item with two states:
import QtQuick 2.0
import si.testfirm 1.0
Item
{
id: ueDatabaseStatusIndicator
property string ueParamImageStatusOn
property string ueParamImageStatusOff
state: ueApplicationStatus.m_ueBluetoothPrinterConnectionStatus===UeTypeBluetootPrinterConnectionStatus.NOT_PAIRED?
"ueStatusIndicatorBluetoothNotConnected":
"ueStatusIndicatorBluetoothConnected"
Image
{
id: ueStatusIndicatorCurrentImage
smooth: true
fillMode: Image.PreserveAspectFit
width: 96
height: 96
sourceSize.width: 96
sourceSize.height: 96
} // Image
states:
[
State
{
name: "ueStatusIndicatorBluetoothConnected"
PropertyChanges
{
target: ueStatusIndicatorCurrentImage
source: ueParamImageStatusOn
} // PropertyChanges
}, // State
State
{
name: "ueStatusIndicatorBluetoothNotConnected"
PropertyChanges
{
target: ueStatusIndicatorCurrentImage
source: ueParamImageStatusOff
} // PropertyChanges
} // State
] // states
} // Item
In first state, named ueStatusIndicatorBluetoothNotConnected, it shows red icon, which resembles bluetooth printer is not paired. In second state, named ueStatusIndicatorBluetoothConnected, it shows blue icon, which resembles bluetooth printer is paired with app. Now, when I run this app with following main.cpp file:
#include <QtQml>
#include <QApplication>
#include <QQmlApplicationEngine>
#include "database/uepeoplemodel.h"
#include "core/ueapplicationstatus.h"
#include "core/uedatabaseconnectionstatus.h"
#include "core/uebluetoothmanager.h"
#include "core/uebluetoothprinterconnectionstatus.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QQmlApplicationEngine engine;
UeApplicationStatus* ueApplicationStatus=new UeApplicationStatus(qApp);
UePeopleModel* uePeopleModel=new UePeopleModel(qApp);
UeBluetoothManager* ueBtManager=new UeBluetoothManager(qApp);
QObject::connect(uePeopleModel,
SIGNAL(ueSignalDatabaseConnectionChanged(UeDatabaseConnectionStatus::UeTypeDatabaseConnectionStatus)),
ueApplicationStatus,
SLOT(ueSlotDatabaseConnectionChanged(UeDatabaseConnectionStatus::UeTypeDatabaseConnectionStatus)));
QObject::connect(ueBtManager,
SIGNAL(ueSignalBtPrinterConnectionChanged(UeBluetoothPrinterConnectionStatus::UeTypeBluetootPrinterConnectionStatus)),
ueApplicationStatus,
SLOT(ueSlotBtPrinterConnectionChanged(UeBluetoothPrinterConnectionStatus::UeTypeBluetootPrinterConnectionStatus)));
engine.rootContext()->setContextProperty("uePeopleModel",
uePeopleModel);
engine.rootContext()->setContextProperty("ueApplicationStatus",
ueApplicationStatus);
engine.rootContext()->setContextProperty("ueBtManager",
ueBtManager);
engine.addImageProvider(QLatin1String("uePeopleModel"),
uePeopleModel);
qmlRegisterUncreatableType<UeDatabaseConnectionStatus>("si.testfirm",
1,
0,
"UeTypeDatabaseConnectionStatus",
"Database Connection Status");
qmlRegisterUncreatableType<UeBluetoothPrinterConnectionStatus>("si.testfirm",
1,
0,
"UeTypeBluetootPrinterConnectionStatus",
"Bluetooth Printer Connection Status");
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
uePeopleModel->ueConnectToDatabase();
ueBtManager->ueStartPairing();
ueApplicationStatus->ueUpdate(uePeopleModel->ueFetchUsers());
return app.exec();
}
in the app red icon is showed, which is ok, since printer is not paired, however, with the line ueBtManager->ueStartPairing(); I start searching for bluetooth printer and the printer is found and paired, since slot void UeBluetoothManager::ueSlotPairingFinished(const QBluetoothAddress& address,QBluetoothLocalDevice::Pairing pairing) gets called as you can see from screenshot:
In the last line, as you can see from screenshot, I emit signal UeBluetoothManager::void ueSignalBtPrinterConnectionChanged(const UeBluetoothPrinterConnectionStatus::UeTypeBluetootPrinterConnectionStatus& newStatus); which is called in main.cpp by ueApplicationStatus object to update its status. Here is UeApplicationStatus header:
#ifndef UEAPPLICATIONSTATUS_H
#define UEAPPLICATIONSTATUS_H
#include <QObject>
#include <QList>
#include <QDebug>
#include "../core/uetypes.h"
#include "../core/uedatabaseconnectionstatus.h"
#include "../core/uebluetoothprinterconnectionstatus.h"
class UeApplicationStatus : public QObject
{
Q_OBJECT
Q_PROPERTY(UeTypeUsers* m_ueUsers
READ ueUsers
WRITE ueSetUsers
NOTIFY ueSignalUsersChanged)
Q_PROPERTY(UeDatabaseConnectionStatus::UeTypeDatabaseConnectionStatus m_ueDatabaseConnectionStatus
READ ueDbConnectionStatus
WRITE ueSetDbConnectionStatus
NOTIFY ueSignalDatabaseConnectionChanged)
Q_PROPERTY(UeBluetoothPrinterConnectionStatus::UeTypeBluetootPrinterConnectionStatus m_ueBluetoothPrinterConnectionStatus
READ ueBtPrinterConnectionStatus
WRITE ueSetBtPrinterConnectionStatus
NOTIFY ueSignalBtPrinterConnectionChanged)
private:
UeTypeUsers* m_ueUsers;
UeDatabaseConnectionStatus::UeTypeDatabaseConnectionStatus m_ueDatabaseConnectionStatus;
UeBluetoothPrinterConnectionStatus::UeTypeBluetootPrinterConnectionStatus m_ueBluetoothPrinterConnectionStatus;
public:
explicit UeApplicationStatus(QObject *parent = 0);
~UeApplicationStatus();
inline UeTypeUsers* ueUsers() const
{ return this->m_ueUsers; }
inline UeDatabaseConnectionStatus::UeTypeDatabaseConnectionStatus ueDbConnectionStatus() const
{ return this->m_ueDatabaseConnectionStatus; }
inline UeBluetoothPrinterConnectionStatus::UeTypeBluetootPrinterConnectionStatus ueBtPrinterConnectionStatus() const
{ return this->m_ueBluetoothPrinterConnectionStatus; }
inline void ueSetUsers(UeTypeUsers* const users)
{ this->m_ueUsers=users; }
inline void ueSetDbConnectionStatus(const UeDatabaseConnectionStatus::UeTypeDatabaseConnectionStatus& status)
{ this->m_ueDatabaseConnectionStatus=status; }
inline void ueSetBtPrinterConnectionStatus(const UeBluetoothPrinterConnectionStatus::UeTypeBluetootPrinterConnectionStatus status)
{ this->m_ueBluetoothPrinterConnectionStatus=status; }
signals:
void ueSignalUsersChanged();
void ueSignalDatabaseConnectionChanged(const UeDatabaseConnectionStatus::UeTypeDatabaseConnectionStatus& newStatus);
void ueSignalBtPrinterConnectionChanged(const UeBluetoothPrinterConnectionStatus::UeTypeBluetootPrinterConnectionStatus& newStatus);
public slots:
void ueSlotDatabaseConnectionChanged(const UeDatabaseConnectionStatus::UeTypeDatabaseConnectionStatus& newStatus);
void ueSlotBtPrinterConnectionChanged(const UeBluetoothPrinterConnectionStatus::UeTypeBluetootPrinterConnectionStatus& newStatus);
void ueUpdate(UeTypeUsers* const users);
};
#endif // UEAPPLICATIONSTATUS_H
and its implementation:
#include "ueapplicationstatus.h"
UeApplicationStatus::UeApplicationStatus(QObject *parent)
: QObject(parent)
{
this->ueSetUsers(new UeTypeUsers());
this->ueSetDbConnectionStatus(UeDatabaseConnectionStatus::NOT_CONNECTED);
this->ueSetBtPrinterConnectionStatus(UeBluetoothPrinterConnectionStatus::NOT_PAIRED);
connect(this,
SIGNAL(ueSignalDatabaseConnectionChanged(UeDatabaseConnectionStatus::UeTypeDatabaseConnectionStatus)),
this,
SLOT(ueSlotDatabaseConnectionChanged(UeDatabaseConnectionStatus::UeTypeDatabaseConnectionStatus)));
connect(this,
SIGNAL(ueSignalBtPrinterConnectionChanged(UeBluetoothPrinterConnectionStatus::UeTypeBluetootPrinterConnectionStatus)),
this,
SLOT(ueSlotBtPrinterConnectionChanged(UeBluetoothPrinterConnectionStatus::UeTypeBluetootPrinterConnectionStatus)));
} // constructor
UeApplicationStatus::~UeApplicationStatus()
{
delete this->ueUsers();
} // destructor
void UeApplicationStatus::ueSlotDatabaseConnectionChanged(const UeDatabaseConnectionStatus::UeTypeDatabaseConnectionStatus& newStatus)
{
this->ueSetDbConnectionStatus(newStatus);
} // ueSignalDatabaseConnectionChanged
void UeApplicationStatus::ueSlotBtPrinterConnectionChanged(const UeBluetoothPrinterConnectionStatus::UeTypeBluetootPrinterConnectionStatus& newStatus)
{
this->ueSetBtPrinterConnectionStatus(newStatus);
} // ueSlotBtPrinterConnectionChanged
void UeApplicationStatus::ueUpdate(UeTypeUsers* const users)
{
this->ueSetUsers(users);
} // ueUpdate
The question is, why images are not switched on QML side inside custom item ueDatabaseStatusIndicator, which code is listed first?
It could be because of the way you are initialising your application. You are starting the event loop after emitting the signals. Try this.
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
QTimer::singleshot(150, this, [&]() {
uePeopleModel->ueConnectToDatabase();
ueBtManager->ueStartPairing();
ueApplicationStatus->ueUpdate(uePeopleModel->ueFetchUsers());
});
return app.exec();
This is just my guess. Best of luck.
update
inline void ueSetBtPrinterConnectionStatus(const UeBluetoothPrinterConnectionStatus::UeTypeBluetootPrinterConnectionStatus status)
{
m_ueBluetoothPrinterConnectionStatus=status;
emit ueSignalBtPrinterConnectionChanged(m_ueBluetoothPrinterConnectionStatus);
}
You must remove the connect calls as this creates a infinite loop.

Qt 5.3 Can't make QCompass (QSensor) work on Windows 8.1

I can't make sensors works on my Asus Transformer T100.
Magnetometer and Compass don't start, and I have fake value from the accelerometer (always x=0, y=9.8, z=0).
I always get the same result, even with my laptop :
first textEdit:
Initialisation...
QAccelerometer is connected to backend...
QAccelerometer isActive...
Attente des données capteur...
Second textEdit:
ven. juin 6 14:56:41 2014
Acceleration: x = 0
y = 9.8
z = 0
Compass: UNAVAILABLE
QMagnetometer: UNAVAILABLE
And this code :
QList<QByteArray> sensorList = QSensor::sensorTypes();
ui->init->append("Sensor list length: " + QString::number(sensorList.size()).toUtf8());
foreach( QByteArray sensorName, sensorList ) {
ui->init->append("Sensor: " + sensorName);
}
Give me :
Sensor: QAmbientLightSensor
Sensor: QAccelerometer
Sensor: QTiltSensor
Sensor: QOrientationSensor
Sensor: QRotationSensor
Where is QCompass ? QMagnetometer ? Why QAccelerometer is faked ? :'(
Here is my simplified test-code, only with QCompass :
header:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QCompass>
#include <QCompassReading>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void update();
void error(int);
private:
Ui::MainWindow *ui;
QCompass *compass;
QCompassReading *compass_reading;
};
#endif // MAINWINDOW_H
code :
#include <QDateTime>
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->init->setText("Initialisation...");
compass = new QCompass(this);
connect(compass, SIGNAL(readingChanged()), this, SLOT(update()));
connect(compass, SIGNAL(sensorError(int)), this, SLOT(error(int)));
compass->setDataRate(1);
compass->start();
if (compass->isBusy()) {
ui->init->append("QCompass is busy...");
}
if(compass->isConnectedToBackend()) {
ui->init->append("QCompass is connected to backend...");
}
if(compass->isActive()) {
ui->init->append("QCompass isActive...");
}
ui->init->append("Waiting for sensors...");
}
MainWindow::~MainWindow()
{
delete compass;
delete ui;
}
void MainWindow::update()
{
QString text_compass;
ui->textEdit->clear();
accel_reading = accel->reading();
compass_reading = compass->reading();
if(compass_reading != 0) {
text_compass = QDateTime::currentDateTime().toString() +
+ "\nCompass: azimuth = " + QString::number(compass_reading->azimuth());
+ "\ncalibration level = " + QString::number(compass_reading->calibrationLevel());
ui->textEdit->append(text_compass);
}
else {
text_compass = "\nCompass: UNAVAILABLE";
ui->textEdit->append(text_compass);
}
}
void MainWindow::error(int erreur) {
QMessageBox::critical(this, "Erreur", "Erreur num : " + QString::number(erreur).toUtf8());
}
The solution for now is to hack the winrt sensors plugin and rebuild it.
(the sensors backend for winrt works for windows 7/8 desktop application).
First git clone the plugin, or get Qt's source code.
then open src/plugins/sensors/sensors.pro and add these lines :
win32-msvc2012|win32-msvc2013 {
isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = winrt generic dummy
}
winrt|win32-msvc2012|win32-msvc2013 {
isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, winrt):SUBDIRS += winrt
}
REMOVE this line :
isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, winrt):winrt:SUBDIRS += winrt
Then open src/plugins/sensors/winrt/winrt.pro and add this lines :
win32-msvc2012|win32-msvc2013: LIBS += -lruntimeobject
And finally run qmake, make/nmake, make/nmake install
(Ask google for more informations about how to build)
IMPORTANT : the run process should start from the directory where the qtsensors.pro file is (e. g. C:\Qt\5.4\Src\qtsensors).
To get more informations, and follow :
Link to the bug : https://bugreports.qt-project.org/browse/QTBUG-39590
Link to the patch : https://codereview.qt-project.org/#/c/87370/

how to set gtkmm window to open in the centre of the screen?

I am trying make my windows in GTKmm open in the centre of the screen and I can't find a working solution anywhere online. Any insights?
I have been trying everything I can think of with no results...
Here is my code:
#include "viewMenu.h"
#include <iostream>
#include <fstream>
#define MAX_BUF 10
viewMenu::viewMenu()
: frmMenu("cuTAES Review Menu"),
lblChooser("Select Course : "),
lblCourses(""),
lblView(" View "),
lblAppInfo(" Application Info "),
lblStuInfo(" Student Info "),
btnView(" View this Application "),
btnBack(" Back "),
frameTable(4,4,true)
{
set_title("cuTAES Review Menu ");
//set_border_width(50);
add(frameTable);
window.set_position(Gtk::WIN_POS_CENTER);
//frmMenu.add(lblChooser);
//frameTable.attach(frmMenu,0,1,0,0);
frameTable.attach(lblChooser, 1,2,0,1);
char text[MAX_BUF];
std::ifstream inFile("courses.txt", std::ios::in);
if(!inFile){
exit(1);
}
while(!inFile.eof()) {
inFile.getline(text,MAX_BUF);
cboCourse.append(text);
}
frameTable.attach(cboCourse, 2,3,0,1);
//set up my table
frameTable.attach(lblView, 0,1,0,1);
frameTable.attach(lblStuInfo, 0,1,1,2);
frameTable.attach(lblAppInfo, 2,3,1,2);
btnView.signal_clicked().connect(sigc::mem_fun(*this,&viewMenu::btnView_clicked));
frameTable.attach(btnView,3,4,0,1);
btnBack.signal_clicked().connect(sigc::mem_fun(*this, &viewMenu::btnBack_clicked));
frameTable.attach(btnBack,3,4,3,4);
show_all_children();
}
and my Header file:
#ifndef VIEWMENU_H
#define VIEWMENU_H
#include <gtkmm.h>
class viewMenu : public Gtk::Window
{
public:
viewMenu();
virtual ~viewMenu();
protected:
//Signal handlers:
void btnView_clicked();
void btnBack_clicked();
//Member widgets:
Gtk::Table frameTable;
Gtk::Label lblChooser,lblCourses, lblView, lblAppInfo, lblStuInfo, lblCourseDrop;
Gtk::Frame frmMenu;
Gtk::Button btnView, btnBack;
Gtk::ComboBoxText cboCourse;
Gtk::Window window;
};
#endif // MAINMENU_H
Your viewMenu class inherits from the Gtk::Window class. Simply use the set_position function to set the position of the window. Instead of:
window.set_position(Gtk::WIN_POS_CENTER);
Use:
set_position(Gtk::WIN_POS_CENTER);