I have to make a GUI for a touch screen software. It's on the same window as the QTextEdit. I was thinking of something simple with a limited set of characters (I also have to make PIN Pads for other windows later).
The approach I'm thinking of is hard-coding the text modifications done by each button. The problem I'm facing getting the QTextEdit that actually has the focus (is selected by the user's cursor).
So I would like to know how I could find out if a certain QTextEdit currently has focus or not ?
Also if there are better ways to do this whole thing ?
Here is my new code, what's wrong with it ?
#include "settings2.h"
#include "ui_settings2.h"
Settings2::Settings2(QWidget *parent) :
QWidget(parent),
ui(new Ui::Settings2)
{
ui->setupUi(this);
}
Settings2::~Settings2()
{
delete ui;
}
void Settings2::on_q_btn_clicked()
{
QTextEdit *textedit = qobject_cast<QTextEdit*>(QApplication::focusWidget());
if(textedit){
textedit->setText("aze");}
}