yes it has similar functionality. but operation is reverse. i.e. selection buffer to lineEdit. Getting selection buffer at any time is not the issue.
//constructor
connect(m_pClipBoard, SIGNAL(selectionChanged()), this, SLOT(someFunc()));
//some Func
//constructor
m_pClipBoard = QApplication::clipboard();
connect(m_pClipBoard, SIGNAL(selectionChanged()), this, SLOT(someFunc()));
//some Func
QString m_sKeyword = m_pClipBoard->text(QClipboard::Selection)
To copy to clipboard, switch view to plain text mode
the problem is Selection buffer changes asynchroniously and from another application's window (ex:Mozilla, Open Office Writer etc.). And QT documentation says that:
X11 also has the concept of ownership; if you change the selection within a window,
X11 will only notify the owner and the previous owner of the change, i.e. it will not notify all applications that the selection or clipboard data changed.
Lastly, the X11 clipboard is event driven, i.e. the clipboard will not function properly if the event loop is not running. Similarly, it is recommended that the contents of the clipboard are stored or retrieved in direct response to user-input events, e.g. mouse button or key presses and releases.
You should not store or retrieve the clipboard contents in response to timer or non-user-input events.
so signals (selectionChanged() and dataChanged)) are not sent to my application. then i can't get any selectionChange() signal. But if i check the Selection buffer in a endless while loop i see the changes but it wastes much cpu. this behaviour is also against qt's advise.
Any solution/suggestion to do this without using a timer, endless loops.
Bookmarks