Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • QFileDialog very slow with GTK3

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • Can't set ScrollBar in QScrollArea

    3
    0 Votes
    3 Posts
    4k Views
    L
    [quote author="Gerolf" date="1322777479"]why don't you use a table view and a delegate for the editing?[/quote] Oooh great Gerolf, I've never thought about it ! Thanks for your answer ! But for a better explanation, the last block is not implemented, I replace the loop : @/* Loop for Tx Display Area Layout */ for(int indexLayout = 0; indexLayout < TX_DISPLAY_NUMBER; indexLayout++){ tx_ScrollAreaLayout->addWidget(tx_Label[indexLayout] , indexLayout+1 , 0, Qt::AlignLeft); tx_ScrollAreaLayout->addWidget(tx_Channel[indexLayout] , indexLayout+1 , 1, Qt::AlignLeft); tx_ScrollAreaLayout->addWidget(tx_SDI[indexLayout] , indexLayout+1 , 2, Qt::AlignLeft); tx_ScrollAreaLayout->addWidget(tx_Data[indexLayout] , indexLayout+1 , 3, Qt::AlignLeft); tx_ScrollAreaLayout->addWidget(tx_SSM[indexLayout] , indexLayout+1 , 4, Qt::AlignLeft); tx_ScrollAreaLayout->addWidget(tx_Parity[indexLayout] , indexLayout+1 , 5, Qt::AlignLeft); tx_ScrollAreaLayout->addWidget(tx_Status[indexLayout] , indexLayout+1 , 6, Qt::AlignLeft); }@ by the loop : @for(int indexLayout = 0; indexLayout < TX_DISPLAY_NUMBER; indexLayout++){ txDisplayArea->setWidget(tx_Label[indexLayout]); txDisplayArea->setWidget(tx_Channel[indexLayout]); txDisplayArea->setWidget(tx_SDI[indexLayout]); txDisplayArea->setWidget(tx_Data[indexLayout]); txDisplayArea->setWidget(tx_SSM[indexLayout]); txDisplayArea->setWidget(tx_Parity[indexLayout]); txDisplayArea->setWidget(tx_Status[indexLayout]); }@ but each loop doesn't make what I want : set the scroll bar So I'll try with QTableView, I think this is the best way to realize what I want! Thanks a lot !
  • How QGraphicsTextItem can be not sized during scaling of QGraphicView

    3
    0 Votes
    3 Posts
    7k Views
    A
    Did you try the QGraphicsItem::ItemIgnoresTransformations flag?
  • QRegExp not supporting \n back-references in Lookaheads?

    2
    0 Votes
    2 Posts
    2k Views
    A
    QRegExp is indeed rather limited. I don't know if this issue you run into is a (known) limitation (can't find it in de docs with a quick scan). However, I do know that this issue will be addressed in Qt 5, as the regexp engine will be replaced by something a bit more standard, featured and performant.
  • How can we know the polygon contains many pixels?

    7
    0 Votes
    7 Posts
    3k Views
    A
    The fact that Qt can fill your polygon, does not mean that it knows how many pixels are red. Filling doesn't work that way. You could of course paint your polygon into a QImage, and can the image line by line to count the number of colored pixels. Not very efficient, but perhaps enough for your goals?
  • How can I open an existing Sqlite database?

    3
    0 Votes
    3 Posts
    11k Views
    G
    @ db.setDatabaseName("data.sqlite"); @ searches in the current working directory, if that's wrong, give an absolute path as the argument.
  • Making a simpler FancyTabBar (like QtCreator uses)

    2
    0 Votes
    2 Posts
    3k Views
    G
    Bascially, there's a QStackedLayout (m_modesStack if I recall correctly) which holds the widgets corresponding to the selected icon (aka mode).
  • [SOLVED] Crash in QRegExp::setPattern - Access violation

    8
    0 Votes
    8 Posts
    4k Views
    G
    You're welcome. Glad to know it works now. You might add "[Solved]" to the topic (just hit the edit button of the very first post in the thread and adjust the title).
  • QString to LPCTSTR conversion

    5
    0 Votes
    5 Posts
    13k Views
    G
    If it is a pure in parameter, you can try: @ void fooSub(LPSTSTR X); // this is our function :-) foo() { QString text; if(sizeof(TCHAR) == 1) fooSub((LPCSTR)text.toLocal8Bit().constData()); // here you have to check, how to convert, you could also use utf8(), ... else fooSub((LPCWSTR)text.utf16()); } @
  • What is qt equalient of normal win32 window

    7
    0 Votes
    7 Posts
    4k Views
    G
    [quote author="Ashish Mittal" date="1322728419"]Hi, Morever, if I will use getDC() function of QWidet to pass DC to some other app of QWidet to draw on widget, can we use same code for Linux also, since it is wriiten like this function is not portable. If not then what could be the other alternative.? [/quote] If you use stuff like getDC, winID etc, the code is not portable. This is platform specific stuff and must be implemented for each platform using #if
  • How to drag & drop rows within QTableWidget

    7
    0 Votes
    7 Posts
    23k Views
    G
    I wanted the same functionality for my app. So I searched through internet and didnt find anything. So I had to do it. So, you can do it with QTableWidget by using the cellEntered(int,int); then takeItem(row, col) and then setItem()... @connect(ui->tableWidget, SIGNAL(cellEntered(int,int)), this, SLOT(cellEnteredSlot(int,int)));@ @void MainWindow::cellEnteredSlot(int row, int column){ int colCount=ui->tableWidget->columnCount(); int rowsel; if(ui->tableWidget->currentIndex().row()<row) rowsel=row-1; //down else if(ui->tableWidget->currentIndex().row()>row) rowsel=row+1; //up else return; QList<QTableWidgetItem*> rowItems,rowItems1; for (int col = 0; col < colCount; ++col) { rowItems << ui->tableWidget->takeItem(row, col); rowItems1 << ui->tableWidget->takeItem(rowsel, col); } for (int cola = 0; cola < colCount; ++cola) { ui->tableWidget->setItem(rowsel, cola, rowItems.at(cola)); ui->tableWidget->setItem(row, cola, rowItems1.at(cola)); } }@ Warning: I think theres a bug. Although it works fine by clicking and holding the left mouse button and moving mouse up or down, it also works with Mouse WHEEL Scroll. I have not figure it out yet on how to check if mouse wheel was triggered so not to move selected row. The doc says: bq. This signal is only emitted when mouseTracking is turned on, or when a mouse button is pressed while moving into an item. BUT when you scroll the mouse wheel is not a mouse button press action. So I think its a BUG. Should I submit it?
  • [Solved] Operator<< Overloading for std::cout, does not work.

    4
    0 Votes
    4 Posts
    6k Views
    G
    It works in the header file if you have an operator definition inside a class declaration.
  • Mac right-to-left issue

    5
    0 Votes
    5 Posts
    2k Views
    G
    The application setting is just the default for the widgets.
  • [Solved] Catch application crash and/or display message

    9
    0 Votes
    9 Posts
    10k Views
    R
    Well if there are no more suggestions, I guess that leaves me no choice, lol, will have to check breakpad again. Thanks for the input everyone.
  • 0 Votes
    3 Posts
    3k Views
    G
    It depends on the method you use to get out of the editing cell. Using tab, for example, you can close the editor of the current cell and open the next cell. The close of the first cell triggers your slot, the message box takes way focus and thus triggers the close of the second cell's editor, hence your slot is called twice. Using qDebug() does not trigger this, as there is no popup stealing the focus. From a quick look at the docs, I doubt that it is ok to use two QErrorMessage dialogs simultaneously (what you probably do). I would add a member pointing to a pointer to a QErrorMessage dialog in the header, create that in the constructor and reuse that instead of creating a new msgBox every time. If that doesn't work, build your app in debug mode and run it through a debugger to get a useful stack trace.
  • QString::utf8() - is it re-entrant or not?

    7
    0 Votes
    7 Posts
    4k Views
    G
    Thanx for clarifying. I've added a "DocNote":/doc/qt-4.7/qstring.html#note-104 to [[Doc:QString]]'s online docs.
  • Need help on QTextEdit

    9
    0 Votes
    9 Posts
    8k Views
    G
    That code is given in the wiki page too. If you search a little bit you find a comment "reset the word highlight". You need to reset the extra highlight.
  • Phonon - Play several times

    5
    0 Votes
    5 Posts
    5k Views
    F
    Well, it is solved After large search i have the solution. I use createPlayer and VideoPlayer and it works pretty nice. And about the last problem that i reported, it is all about codecs... It worked in Windows xp but not in Windows 7, so I installed the k-lite codec and it works... but only if i try with the K-Lite codec for 32bits, if I install the 64bits version, or both, it does not work. http://www.codecguide.com/download_kl.htm @For use on 64-bit versions of Windows. For an optimal user experience it is highly recommended to also install one of the 32-bit variants from above, because most software that runs on 64-bit versions of Windows is still 32-bit. Windows Vista x64 and Windows 7 x64 use a 32-bit version of Windows Media Player by default. Windows Media Center and Windows Explorer are 64-bit applications. That is why you need both 32-bit and 64-bit codecs.@ Do not install both. Only the 32bit version ;) So be carefull with this... it took me a lot of time to figure it out.
  • QSystemTrayIcon[SOLVED]

    3
    0 Votes
    3 Posts
    2k Views
    D
    Thank you for your answer. Actually that one "yourApp.setQuitOnLastWindowClosed(false);" was enough.