Originally Posted by
wysota
Right... it's from Qt4. In Qt3 you can achieve the same by applying event filters to both text edits and catching focusIn events.
I just tried as you said.
I have done like this
firstTextEdit->installEventFilter( this ); //this indicates my QMainwindow
secondTextEdit->installEventFilter( this );
firstTextEdit->installEventFilter( this ); //this indicates my QMainwindow
secondTextEdit->installEventFilter( this );
To copy to clipboard, switch view to plain text mode
then in
{
if ( obj
== firstTextEdit
&& e
->type
() == QEvent::FocusIn ) _first = true;
else
_first = false;
}
//_first is member variable which tells that the previous focusIn was of firstTextEdit
Then I check the boolean value in the slot that I have defined
void MainWindow::switch()
{
if(_first)
second->setFocus();
else
first->setFocus();
}
bool MainWindow::eventFilter( QObject *obj, QEvent *e )
{
if ( obj == firstTextEdit && e->type() == QEvent::FocusIn )
_first = true;
else
_first = false;
}
//_first is member variable which tells that the previous focusIn was of firstTextEdit
Then I check the boolean value in the slot that I have defined
void MainWindow::switch()
{
if(_first)
second->setFocus();
else
first->setFocus();
}
To copy to clipboard, switch view to plain text mode
But still the problem is that the cursor is not visible. When I check this condition
if(_first)
second->setFocus();
else
first->setFocus();
if _first is true then the focus should be on second but since the doxkwindow is active the cursor is not visible.
Please give me some more suggestions wysota...
Thankx in advance
Bookmarks