Hi there, first post to the forums. Hope someone can help me.
I have a list view which is populated by any of a number of background threads (mutex locked of course ;-). The problem I have is that the list view only redraws with the new rows when I resize it (it's in a docking window).
I guess I need to emit a signal to get it to redraw but I've tried every signal I can find and still no joy. Code sample follows. What am I doing wrong. I guess I need to get the main event loop to fire but how do I send an appropriate event from another thread?
{
Q_OBJECT
public:
void logMessage(const std::string& sMessage) {
boost::mutex::scoped_lock scoped_lock(m_oMessageListMutex);
setCurrentItem (item);
update();
emit itemChanged(item);
emit itemActivated (item);
emit itemClicked (item);
emit itemDoubleClicked (item);
emit itemEntered (item);
emit itemPressed (item);
}
protected:
boost::mutex m_oMessageListMutex;
};
class MessageList : public QListWidget
{
Q_OBJECT
public:
MessageList(QWidget* pW) : QListWidget(pW) {}
void logMessage(const std::string& sMessage) {
boost::mutex::scoped_lock scoped_lock(m_oMessageListMutex);
QListWidgetItem *item = new QListWidgetItem(sMessage.c_str(), this);
setCurrentItem (item);
update();
emit itemChanged(item);
emit itemActivated (item);
emit itemClicked (item);
emit itemDoubleClicked (item);
emit itemEntered (item);
emit itemPressed (item);
}
protected:
boost::mutex m_oMessageListMutex;
};
To copy to clipboard, switch view to plain text mode
Many thanks
Dave
Bookmarks