Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Remove item from QToolBox

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Subclassing QThread - Changing the community note

    5
    0 Votes
    5 Posts
    2k Views
    K
    The new documentation for 5.0 will be updated to promote the best practise of not subclassing QThread. Hopefully this will end all the questions related to subclassing QThread and the problems that arise from this.
  • [Solved] Conversion from DWORD to QString

    9
    0 Votes
    9 Posts
    11k Views
    sierdzioS
    Pleasure. Please add "[Solved]" to the beginning of the topic's title if you consider this to be solved.
  • Not able to build a Qt project in visual studio 2005

    12
    0 Votes
    12 Posts
    4k Views
    K
    [quote author="Vikuseth" date="1353560942"]So you are saying vsaddin is used only to build a Qt project inside VS2205 ? [quote author="Flavio Portela" date="1353543932"]you compiled only QtSDK released. In Visual Studio configure in mode released. or Rebuild QtSDK for --released and --debug vsaddin just necessary if you use VS-IDE for build your project. Use qtcreator6.0, he compile in vs2005 and or mingw without IDEVS2005 or greater.[/quote] [/quote] vsaddin helps you to manage projects within the vs2005 IDE (and other vs versions). However, you need to have a licensed vs version. The free express versions do not allow addins. You can load .pro files and create .pro files for compatibility with creator respectively other qmake driven environments. When using vsaddin you do not need to bother qmake. The creation and use of Qt in the IDE is seamless.
  • [SOLVED] how to use QRegExp to find some continue spaces?

    3
    0 Votes
    3 Posts
    5k Views
    C
    So you have numbers right justified in fixed width columns and you want to work out the widths of the columns, which includes the leading spaces. @ QString line(" 178542 5 5 5 0 1447 33386 1452 1452 44585 44631 1452 44576"); QList<int> widths; QRegExp re("\s+\S+"); int pos = 0; while ((pos = re.indexIn(line, pos)) != -1) { widths << re.matchedLength(); pos += re.matchedLength(); } qDebug() << widths; // (12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8) @ Of course, it won't work if some of the columns are "empty" or if the column can contain spaces.
  • Read pointers of a process

    3
    0 Votes
    3 Posts
    1k Views
    I
    Probably l3e0wulf talks about function like ReadProcessMemory from WINAPI.
  • Qt & VS2005 MFC

    7
    0 Votes
    7 Posts
    3k Views
    F
    you not need the vsaddin utilie qtcreator6.0 and compile for mingw and vs2005.
  • Terminating all threads.

    2
    0 Votes
    2 Posts
    2k Views
    M
    Not exactly sure what your problem is. But in general you should not terminate threads, using QThread::terminate() because it may terminate the thread at an arbitrary position, which could result in resources not being freed up properly or data being left in inconsistent state (and other evil side-effects). Instead, use QThread::wait() to wait for the thread to terminate. Do this for all the QThread objects that you have in your QList<QThread*> list and you can be sure they all have been terminated - given that the list is complete. In addition to that, you might want to have a global "terminate" flag, which you set to TRUE as soon as you want your threads to terminate. The code executed by each thread should then check that flag at regular intervals and exit as soon as possible (but cleanly!), when the flag is set. @volatile bool g_terminate = false; QList<QThread*> client_thread; //Main Thread void TCPServer::stopServer(void) { [...] //tell all threads to terminate asap g_terminate = true; //Wait until all threads have finished foreach(QThread *term_thread, client_thread) { bool ok = term_thread->wait(5000); //Thread did not terminate (timeout), probably deadlocked! if(!ok) { qWarning("Thread is deadlocked, going to terminate, expect trouble!"); thread->terminate(); thread->wait(); } } } //Worker Thread(s) void MyThread::run(void) { while(moreWorkLeft && !g_terminate) { doSomeWork(); } } @
  • Printing jpeg images in Qt with special quality

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Qt way to install a package under Linux?

    2
    0 Votes
    2 Posts
    1k Views
    P
    I think the best and more secure way is to create distribution specific packages and let the package manager handle required and optional dependencies. I suspect the applications that offer to install optional dependencies use the distribution's package manager in the background.
  • [Resolved] Select Button Effect without use CSS style...

    2
    0 Votes
    2 Posts
    1k Views
    D
    Resolved using CSS: @ pushButton->setStyleSheet("QPushButton {font-weight:bold;}") @
  • Empty rows in QTableWidget

    10
    0 Votes
    10 Posts
    16k Views
    D
    [quote author="ChrisW67" date="1353472147"]I assume the slot is being called because you are manually connecting something to it. You have a slot called on_procTable_updated(bool) in your class that the ui->setup() tries to find a match for in the UI using QMetaObject::connectSlotsByName(). It fails because you do not have a widget called "procTable" that has a signal called "updated(bool)" in that UI. It's a warning, not an error. You can avoid it by naming your manually connected slot so it does not match the magic pattern. [/quote] Thank you, that explains a lot. I've gotten rid of the warning now. I was under the impression that by the way I had named the signal and the slot they should have successfully connected without the call to connect(), though.
  • [solved] Write into Excel table

    2
    0 Votes
    2 Posts
    4k Views
    S
    I found the solution here "Writing a Range of Rows & Columns to a Worksheet":http://www.qtforum.org/article/34059/qt-and-excel-writing-a-range-of-rows-columns-to-a-worksheet.html
  • Unsuccessfully post Event

    5
    0 Votes
    5 Posts
    2k Views
    P
    thanks. but my basic idea is to simulate a wheel Event as soon as something happen. post QWheelEvent is one of my choose. I have no idea what is wrong with my code above? welcome any other talent.
  • QDesktopServices and Networkpath

    5
    0 Votes
    5 Posts
    3k Views
    K
    Hmmm, okay, I'm not sure if I get it ... so one more example of what I'm doing (I might not have been very clear in my top post, sorry for that ...): I've got a html document on //nas01/dir/index.html. I open this html with QWebkit: @ def _init_web_viewer(self): self.web_viewer = QtWebKit.QWebView() self.web_viewer.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks) self.web_viewer.linkClicked.connect(self.open_in_external_browser) self.web_viewer.load(//nas01/dir/index.html) def open_in_external_browser(self, url): QDesktopServices.openUrl(url) @ Now I want that all links in this index.html are opened with the standard applications, e.g. IE (for flash content, I know there're ways to enable this in QWebKit, but I can't use those), Adobe Reader, Word, Outlook, ... My html looks like this: @ <!DOCTYPE html> <html> <head> <title>My App</title> </head> <body> <a href="flash_content.html">FlashStuff</a> <a href="doc.pdf">MyDocumentation</a> <a href="stuff/stuff_doc.pdf">Stuff Documentation</a> </body> </html> @ All files are located at the nas //nas01/dir/ and subdirs. When I replace the locations in the index.html by absolute paths pointing to a mapped drive, e.g. Z:\dir\doc.pdf where //nas01 is mounted at Z:, it does work as expected. Unfortunately I can't do that in my production environment. Cheers, Jan
  • PDF Paging issues text overflow

    4
    0 Votes
    4 Posts
    2k Views
    Z
    [quote author="asweetroxxi" date="1353505884"]the issue is the table is being populated from sql datebase would this be an issue. And i just started programming so please be discriptive me coding is still weak. [/quote] The fact that the text is not properly cut between pages in the resulting PDF file is not related to where you get the data from, being it a sql database, file or you simply add rows to the QTableWidget programmatically. Again I never used QTableWidget to print the data as a table in PDF file, but I used QWebView for that without the issue you have. If you want to to do it with QWebView you will need to read the docs on it and have some knowledge in HTML to be able to prepare the html page properly.
  • [solved]qt sql insert statement system not working

    22
    0 Votes
    22 Posts
    13k Views
    B
    Ok, set your thread to [solved] :)
  • 0 Votes
    4 Posts
    7k Views
    F
    Hi napajejenunedk, Did get the solution at the end? I'm facing exactly the same problem. Turns out that disabling the window management you lose all other capabalities such as minimize and keyboard focus, as documented in Qt documentation. Maybe removing the window management during the drag options and enabling again (but this would genarating some flickering). ...still, not desired.
  • Strange error message from QtCreator

    5
    0 Votes
    5 Posts
    2k Views
    B
    [quote author="gayu" date="1353498871"]Hope so the link will be helpful for you http://doc.qt.digia.com/qtcreator-snapshot/creator-debugger-engines.html[/quote] I've done what I'd read here, but this not solved my problem...
  • How to redirect QMessageBox text to a Textfile

    8
    0 Votes
    8 Posts
    3k Views
    A
    Ok, I have not tried this myself, but I would try this: Create an object that you install as an event filter on your QApplication. Listen for ShowEvents, and see if the object it was aimed at is a QMessageBox subclass. If so, you can read the text from it and log that.