I thought it would be simple like this
{
if(ui->actions->rect().contains(mme->pos())){
ui->actions->setVisible(true);
}
else{
ui->actions->setVisible(false);
}
}
}
void MessageForm::mouseMoveEvent(QMouseEvent *mme)
{
if(mme->type() == QMouseEvent::MouseMove){
if(ui->actions->rect().contains(mme->pos())){
ui->actions->setVisible(true);
}
else{
ui->actions->setVisible(false);
}
}
}
To copy to clipboard, switch view to plain text mode
i am not using mouse event of widget with buttons but from parent widget. The first problem was one overlay floating widget and one stretch widget. solved with
Q_UNUSED(re);
ui->actions->move(width() - ui->actions->width() - 20, 20 );
ui->textEdit->resize(this->size());
}
void MessageForm::resizeEvent(QResizeEvent* re) {
Q_UNUSED(re);
ui->actions->move(width() - ui->actions->width() - 20, 20 );
ui->textEdit->resize(this->size());
}
To copy to clipboard, switch view to plain text mode
in form constructor i have
ui->setupUi(this);
setMouseTracking(true);
ui->textEdit->move(0,0);
ui->actions->setVisible(false);
resizeEvent(NULL);
ui->setupUi(this);
setMouseTracking(true);
ui->textEdit->move(0,0);
ui->actions->setVisible(false);
resizeEvent(NULL);
To copy to clipboard, switch view to plain text mode
but, of course, there is QTextEdit that takes mouse events. It doesnt feel right to reimplement QTextEdit (it is not realy text editing function what am i reimplementing), but it takes away mouse events i intended from form.
So i thought that i just made a blunder, and that i am doing it wrong. Maybe someone here acomplished same thing.
Or, Is there a way for parent widget tho know the mouse position if the mouse is over the widget itself and/or its children widgets?
Bookmarks