Why do I get the "qt.pointer.dispatch" error? - c++

I am making a little app in Qt Creator, and I keep getting this error/warning from qt.pointer.dispatch:
qt.pointer.dispatch: delivering touch release to same window QWindow(0x0) not QWidgetWindow(0x14ef0d570, name="MainWindowWindow")
qt.pointer.dispatch: skipping QEventPoint(id=1 ts=0 pos=0,0 scn=1063.83,670.067 gbl=1063.83,670.067 Released ellipse=(1x1 ∡ 0) vel=0,0 press=-1063.83,-670.067 last=-1063.83,-670.067 Δ 1063.83,670.067) : no target window
I'm not doing anything special with touch release (as you can see below), and the error also doesn't affect the running of the program so far as I can tell. What is the problem and how do I fix it?
main.cpp
#include "mainwindow.hpp"
#include <QApplication>
#include <QLocale>
#include <QTranslator>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTranslator translator;
const QStringList uiLanguages = QLocale::system().uiLanguages();
for (const QString &locale : uiLanguages) {
const QString baseName = "Simulization_" + QLocale(locale).name();
if (translator.load(":/i18n/" + baseName)) {
a.installTranslator(&translator);
break;
}
}
MainWindow w;
w.show();
return a.exec();
}
mainwindow.cpp
#include "mainwindow.hpp"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}

Related

qInputDialog make visible Unity taskbar and titlebar in fullscreen application

I'm trying to ask for a password the user in order to access a particular section, my application is fullscreen. The problem is that when the qInputDialog appears also the unity taskbar and the application titlebar appears. I want to avoid this and keep my application fullscreen.
I'm using Qt 5.12.3 on Ubuntu 16.04
Take a look at this simple example:
Main.cpp
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.showFullScreen();
return a.exec();
}
MainWindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QInputDialog>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
bool ok;
QString text = QInputDialog::getText(this, tr("Restriscted"),
tr("Password:"), QLineEdit::Password,"",&ok, Qt::FramelessWindowHint);
if (ok && text=="pass")
{
ui->label->setText("ok");
}
}
Seems there is no solution for this at the moment and the issue depends on Unity. At the end I replaced the qInputDialog with a qStackedView page with a qLabel and a qButton on it, then I hide/show the page accordingly.

Qt desktop app will not close old dialogs and will not allow more than 2 windows to be open at a time

I am trying to open up my app with a child window first. I got some code that almost works, but I cannot for the life of me figure out what is wrong with it that won't let it delete old dialog windows, and when I click back into the child dialog I opened with, it glitches out and I just end back up at square one! What should I do to stop this problem?
main.cpp file
#include "mainwindow.h"
#include <QApplication>
#include "yes.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget MainWindow;
MainWindow.show();
yes popup(&MainWindow);
popup.show();
return a.exec();
}
.cpp file
#include "yes.h"
#include "ui_yes.h"
#include "mainwindow.h"
yes::yes(QWidget *parent) :
QDialog(parent),
ui(new Ui::yes)
{
ui->setupUi(this);
ui->label->setVisible(false);
}
yes::~yes()
{
delete ui;
}
void yes::on_pushButton_clicked()
{
auto no = new MainWindow();
no->show();
no->setAttribute(Qt::WA_DeleteOnClose);
no->show();
}

Qt Display Japanese Character as Square

I have a simple program, in which I need to display japanese characters. It has a bit strange behaviour( in my opinion ), sometimes it displays character as it is, sometimes it displays it like square.
Normal/correct display
Issue observed time
My code as follows
japanesedisplay.cpp
#include "japanesedisplay.h"
#include "ui_japanesedisplay.h"
JapaneseDisplay::JapaneseDisplay(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::JapaneseDisplay)
{
ui->setupUi(this);
ui->label->setText("こんにちは");
}
JapaneseDisplay::~JapaneseDisplay()
{
delete ui;
}
main.cpp
#include "japanesedisplay.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
JapaneseDisplay w;
w.show();
return a.exec();
}
My Qt version : 5.3.2
My Platform : Ubuntu 14.04 LTS
Thanks in advance.

How to hide application on taskbar?

I am trying to hide my QT application from taskbar? I cannot find anything in Google so I asking here.
Solution from Qt Hide Taskbar Item (Qt Hide Taskbar Item) and this->hide() is not helping.
main.cpp
#include "status_bar.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
status_bar w;
w.show();
return a.exec();
}
status_bar.cpp:
#include "status_bar.h"
#include "ui_status_bar.h"
#include <stdlib.h>
#include <QTime>
#include <QTimer>
#include <QApplication>
#include <QDesktopWidget>
status_bar::status_bar(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::status_bar)
{
ui->setupUi(this);
setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
resize(QApplication::desktop()->width(),36);
ui->time->move(QApplication::desktop()->width()-ui->time->size().width(),10);
ui->username->setText(getenv("USER"));
timeupdate = new QTimer(this);
connect(timeupdate, SIGNAL(timeout()),
this, SLOT(UpdateClock()));
timeupdate->start(100);
}
void status_bar::UpdateClock()
{
ui->time->setText(QTime::currentTime().toString("HH:mm"));
}
status_bar::~status_bar()
{
delete ui;
}
EDIT:
With code like this window is empty.
class MyWindowWidget : public QWidget
{
public:
MyWindowWidget(QWidget *parent)
: QWidget(parent, Qt::Dialog)
{
}
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
status_bar window;
MyWindowWidget widget(&window);
widget.show();
return app.exec();
}
Solved by using Qt::Tool flag.
Qt::Tool flag has other problems for me, like this widget/windows is hidden when its state becomes inactive.
I would recommend you to use Qt::ToolTip

Controlling Multiple UI files in Qt framework

Question asked twice: see Handling multiple ui files in Qt
I am new to Qt framwork , i have been given this simple task:
In the MainWindow , i have a submit button , once its clicked another total different window should appear
i thought of doing this by doing one extra UI file called From.ui file and to switch from MainWindow to Form once submit is clicked , this is my code:
//main.cpp
#include "mainwindow.h"
#include <QtGui/QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow mainWindow;
mainWindow.setOrientation(MainWindow::ScreenOrientationAuto);
mainWindow.showExpanded();
return app.exec();
}
//MainWindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "form.h"
#include <QtCore/QCoreApplication>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow:: SubmitClicked()
{
Form* f= new Form(this);
f->show();
f->raise();
f->activateWindow();
}
//Form.cpp
#include "form.h"
#include "ui_form.h"
Form::Form(QWidget *parent) :
QWidget(parent),
ui(new Ui::Form)
{
ui->setupUi(this);
}
Form::~Form()
{
delete ui;
}
this code compiled perfectly , but its not doing as expected , once submit is clicked , nothing is done...
can you please tell me whats wrong ?
It seems that SubmitClicked slot is not connected to clicked event of your button
Put a cout/printf at the top of your SubmitClicked method to make sure that it is called.