Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • QGraphicsView OpenGL

    4
    0 Votes
    4 Posts
    5k Views
    A
    Anything new here? I still have the same two issues in Qt 4.8.0.
  • [Solved] A possible bug in QWidget::layout()

    4
    0 Votes
    4 Posts
    2k Views
    G
    No problem, I just wanted to be sure :)
  • Configure on Ubuntu

    11
    0 Votes
    11 Posts
    7k Views
    M
    Thank you guys, The problem still exists. Does anybody configured Qt 4.8 on Ubuntu?
  • How to define your own mouse?

    5
    0 Votes
    5 Posts
    3k Views
    R
    What kind of device is that?.. How is it going to communicate with your PC?.. I have used my Nokia 6600 as an optical mouse 4 years ago!! So, I believe in nothing is impossible.. This may not be applicable to your use case, but a small suggestion. Write a program that listens for your "device's" signals, let that Listener program convert those signals into appropriate mouse gestures... If you just need it in your application, then start the listener program on your program start up.. In case of Windows .NET will help you, I have moved my mouse cursor programmatically with the help of a "dll".. Google it!!.
  • Supported linuxes

    10
    0 Votes
    10 Posts
    4k Views
    H
    I can give you example that some parts of system can make issues in your application. In KDE you can use a Oxygene theme - it looks good but application has another feature if you use this theme. Oxygene has a feature "drag by empty spaces", so your app will be draggable by emty spaces until you disable this feature in oxygene-settings. Maybe you have on ubuntu something that change an events in your app?
  • One database table source for multiple models and views

    9
    0 Votes
    9 Posts
    7k Views
    S
    That's true, Seba. When I started I used QSqlQuery for my detail model (the only one I had at the time,) but I was limited to read-only results so I tabled that idea. However, that's all I need for the three summary Qt views. Good idea! I could have used a subclass of QSqlQuery and called ::exec() from a slot for the summary Qt views upon every submit to the detail Qt view. That way, I would not have separate SQLite views, just the single one for the detail info. Thanks.
  • Can I see some simple examples of regular expressions in C++?

    8
    0 Votes
    8 Posts
    9k Views
    0
    Just to be absolutely clear here... have a look at this: @ QSortFilterProxyModel *proxy=new QSortFilterProxyModel(); proxy->setSourceModel(sourcemodel); //The following regexpression filters the column after "NuMbeR1 OR Test3122 OR Dethklok". //I hope the confusion is solved now. QRegExp regExp("NuMbeR1|Test3122|Dethklok"); proxy->setFilterRegExp(regExp); //e.g... ui->view->setModel(proxy); @
  • I can't download Qt developer days Videos

    Locked
    2
    0 Votes
    2 Posts
    2k Views
    G
    See "this thread":/forums/viewthread/12758/ dealing with that very same question. I'm closing this one.
  • QWidget childAt(x, y) method always return NULL [Solved]

    5
    0 Votes
    5 Posts
    6k Views
    A
    Ok, so I solved my problems by ignoring mouse events in the children (the Pixel instances) by calling @event->ignore()@ and have them propagated up the chain to the parent container (the MouseWidget instance).
  • Digital clock (using QTimer) [SOLVED]

    3
    0 Votes
    3 Posts
    3k Views
    0
    Fairly often these problems occur if something is not correctly included, check your .pro file for errors and if you have a main... well if you even use a main function, it would help if you would show the whole code. cheers
  • [Solved]How to create Executable for windows based environment?

    16
    0 Votes
    16 Posts
    6k Views
    S
    [quote author="5mahesh" date="1324629988"] I got my solution. Thank u friends. Within an hours all the Qt based problems are solved here. That's y Qt teams and this forum still rocks...[/quote] I agree. And not only Qt based problems!
  • QSortFilterProxyModel OR connection

    9
    0 Votes
    9 Posts
    4k Views
    0
    Well sounds about right... I Used the "Mysortfilterproxymodel" from the Qt Examples as my first goto... so just for completion some of it is still in here; Mysortfilterproxymodel.h: @ #include <QDate> #include <QSortFilterProxyModel> //! [0] class MySortFilterProxyModel : public QSortFilterProxyModel { Q_OBJECT public: //Example for implementing it(no declarations) : // // myproxy=new MySortFilterProxyModel(); // myproxy->setSourceModel(sourcemodel); // QRegExp regExp("NuMbeR1|Test3122|Dethklok"); // myproxy->setFilterRegExp(regExp); // ui->view->setModel(myproxy); // this implementation will now filter the given rows (not dynamicly given) // after the regular [removed]NuMber1 OR Test3122 etc. etc.) MySortFilterProxyModel(QObject *parent = 0); //these are just included for purposes of completion, //they should be safe to remove. QDate filterMinimumDate() const { return minDate; } void setFilterMinimumDate(const QDate &date); QDate filterMaximumDate() const { return maxDate; } void setFilterMaximumDate(const QDate &date); //thill here not really nessecary protected: bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; bool lessThan(const QModelIndex &left, const QModelIndex &right) const; private: bool dateInRange(const QDate &date) const; QDate minDate; QDate maxDate; }; //! [0] #endif @ Mysortfilterproxymodel.cpp: @ #include <QtGui> #include "mysortfilterproxymodel.h" //! [0] MySortFilterProxyModel::MySortFilterProxyModel(QObject *parent) : QSortFilterProxyModel(parent) { } //! [0] //! [1] void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date) { minDate = date; invalidateFilter(); } //! [1] //! [2] void MySortFilterProxyModel::setFilterMaximumDate(const QDate &date) { maxDate = date; invalidateFilter(); } //! [2] //! [3] bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { //Depending on how many rows have to be filtered... // 1. add new Indiezes // 2. select the concerned rows // 3.add them to your source model via return(just follow the example below) QModelIndex index0 = sourceModel()->index(sourceRow, 5, sourceParent); QModelIndex index1 = sourceModel()->index(sourceRow, 15, sourceParent); QModelIndex index2 = sourceModel()->index(sourceRow, 0, sourceParent); return (sourceModel()->data(index0).toString().contains(filterRegExp()) || sourceModel()->data(index1).toString().contains(filterRegExp())) && dateInRange(sourceModel()->data(index2).toDate()); } //! [3] //! [4] //! [5] bool MySortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const { QVariant leftData = sourceModel()->data(left); QVariant rightData = sourceModel()->data(right); //! [4] //! [6] if (leftData.type() == QVariant::DateTime) { return leftData.toDateTime() < rightData.toDateTime(); } else { QRegExp emailPattern = new QRegExp("([\w\.]@[\w\.]*)"); QString leftString = leftData.toString(); if(left.column() == 1 && emailPattern->indexIn(leftString) != -1) leftString = emailPattern->cap(1); QString rightString = rightData.toString(); if(right.column() == 1 && emailPattern->indexIn(rightString) != -1) rightString = emailPattern->cap(1); return QString::localeAwareCompare(leftString, rightString) < 0; } } //! [5] //! [6] //! [7] bool MySortFilterProxyModel::dateInRange(const QDate &date) const { return (!minDate.isValid() || date > minDate) && (!maxDate.isValid() || date < maxDate); } //! [7] @ Hope it helps. Sorry don't have too much time right now(obviously) but if there are other problems I will get to it as soon as possible. I wish you a very happy Christmas and all good things in 2012!
  • Problem with QStringList - bug or feature?

    12
    0 Votes
    12 Posts
    5k Views
    A
    Thanks for the item number, I have found it. The problem is, I think, that Meyers assumes that the remove() operation only invalidates the iterators pointing to that item. Alas, that is not the case for QList. QList (including QStringList) is not a linked list, but basically an array under the hood. So if you remove an item, items around the item removed may shift, thus also invalidating iterators pointing at those items. I am not exactly sure on the implementation details, but I could even imagine that the question which items shift (the ones behind, or the ones before the removed item) depends on the position of the item that was removed for performance reasons. I think that your original approach would probably work just fine on a QLinkedList, which is much closer to the std::list container than QList is in terms of structure.
  • QSqlRelationalTableModel/QDataWidgetMapper and empty model

    6
    0 Votes
    6 Posts
    3k Views
    B
    Have you got this line?: @ mapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); @
  • Compiling an app in windows for linux

    3
    0 Votes
    3 Posts
    3k Views
    sierdzioS
    "compile everywhere" means what it says: compile separately on every platform. This is C++, after all, it has to be compiled. There are ways to compile for other platforms (so called cross-compilation). Qt has public mkspecs, you can find them on Gitorious - they might help. The easiest and most reliable way (remember, that OSes vary VERY significantly, especially when we talk Unix vs. Windows) is to compile on every platform yourself.
  • How can we remove space only from the end of string?

    4
    0 Votes
    4 Posts
    8k Views
    G
    I would go with a regex: @ QString ttt = " Qt . . . ab "; qDebug() << "ttt" << ttt; ttt.replace(QRegExp("\s*$"), ""); qDebug() << "tt2" << ttt; // output: // ttt " Qt . . . ab " // tt2 " Qt . . . ab" @
  • Embedding a keyboard or Keyboard solution for different languages

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Play an FLV file inside an offline Qt App.

    10
    0 Votes
    10 Posts
    6k Views
    B
    Looks like this might help: http://www.videolan.org/press/lgpl-libvlc.html
  • [SOLVED]Problems with transfer

    13
    0 Votes
    13 Posts
    6k Views
    H
    Ok, i finally fugure out what was wrong with my sending file. Problem was in DataStream. Maybe it's a usual way for writing data in array through QDataStream - get starting write with "\0"-symbol, but i swear - it was a mystery for me. One unfortunate symbol in the file beginning was a symbol of the end of a file. His origin isn't known. When was starting data recording in a file, passing a stream, a problem was solved. Here some code. That stream creates an error: @QByteArray sending_file; sendFile->seek(0); quint64 send=0; while(!sendFile->atEnd()) { sending_file=sendFile->readAll(); quint64 partOfFile=sending_file.size(); out<<sending_file; send+= partOfFile; ui->progressBar->setValue(send); }@ And all of that was transform into: @ QByteArray data; QDataStream out(&data, QIODevice::WriteOnly); *** ui->progressBar->setRange(0,sendingfilesize); ui->progressBar->setValue(0); sendFile->seek(0); quint64 send=0; out.device()->seek(0); quint16 sizeOfDataArray= (quint16)(data.size()-sizeof(quint16)); out<<sizeOfDataArray; _sok->write(data); _sok->flush(); out.device()->reset(); data.clear(); while(!sendFile->atEnd()) { data=sendFile->readAll(); quint64 partOfFile=data.size(); send+= partOfFile; ui->progressBar->setValue(send); } _sok->write(data); _sok->flush();@ Down with intermediaries =) Many thanks for that time that you have given to the decision of my problem. Awfully I apologize for the English - has just now seen, I am how much awful him I own. Once again thanks. I will hope it to somebody will help.
  • 0 Votes
    21 Posts
    12k Views
    K
    You are welcome You have the little problems still existing with the different path definitions possible under windows. So, if you have a solution, I appreciate when you share this. Season's greetings