Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.9k Posts
  • Checkbox label punctuation behaving strangely

    7
    0 Votes
    7 Posts
    3k Views
    R
    Except that it works differently on two machines that are both set to the identical locale. That's not expected. Translating the text into Arabic, yes, maybe picking up colons and shifting them would be intuitive. But the text is English and stays English. Where does it say that individual characters will be searched for and moved, on some machines but not others in identical locales? After all, if I write English right to left (which is what you say I have claimed to do) then presumably I have already put the colon on the wrong end, and want it left there? There is nothing in the Qt docs that indicate that this flag serves any other purpose than to switch the positions of text and checkbox. The entire flavour of the docs is precisely that unicode will take care of itself in Qt. No one said one had to study unicode technical annexes to discover strange behaviour of the colon character. And from what DerManu tells us above, it seems Qt now agree.
  • Proprietary stylesheet for a button in external stylesheet file

    7
    0 Votes
    7 Posts
    3k Views
    A
    [quote author="DerManu" date="1338837244"]So in this case //EDIT: Ah now I think I get it, you want to define inside the CSS file which button name to style, right? I don't know of a Qt-way to do that. Maybe you should parse the CSS file yourself and add some extended syntax which then uses the findChild function to apply it to a QWidget with the specified name.[/quote] yes right. i fixed it with parsing string. thanks a lot.
  • [SOLVED] handling instances of QColor

    2
    0 Votes
    2 Posts
    3k Views
    D
    QColor is mosty passed by const reference (not pointer as in your example!). Effectively this is closer to a pass by value, because the QColor, if stored inside the function you pass it to, gets copied. I don't recommend you use somefunction(QColor*) unless the function explicitly needs to modify the QColor and the caller of the function wants and expects the function to modify it. An example would be a function stripAlphaComponent(QColor* color); which strips the alpha of the passed QColor. In all other cases you should prefer somefunction(const QColor &color); The reason you can pass Qt::black instead of a QColor object is C++: If a function expects a certain class instance as parameter, the function additionally accepts all types from which such an instance can be created uniquely with a constructor of that class. In this case, QColor offers the constructor @ QColor::QColor ( Qt::GlobalColor color ) @ Thus, when you pass Qt::black (which is a Qt::GlobalColor), C++ is smart and sees that there is a unique way to turn a Qt::GlobalColor into a QColor object by calling that constructor, and does it for you. Behind the scenes, these two calls are identical: @ somefunction(Qt::black); somefunction(QColor(Qt::black)); @ if somefunction takes a QColor or a const QColor & (not a QColor*!).
  • [solved] External widget

    6
    0 Votes
    6 Posts
    2k Views
    S
    Eddy ~ I am just promoting our new stuff, we are releasing our 1.1 version this week and we have some really updates and new features. Our 3d stuff and the new image/model rendering widget is very nice…
  • Text animations

    5
    0 Votes
    5 Posts
    3k Views
    T
    It works great. Thank you very much for your help! :) I wasn't aware of the interpolation.
  • [Solved] StyleSheet with absolute path

    7
    0 Votes
    7 Posts
    5k Views
    C
    i change the code and now its ok! @public String loadStyles( String cssPath ) throws FileNotFoundException { FileInputStream fstream = new FileInputStream(cssPath); DataInputStream in = new DataInputStream(fstream); BufferedReader r = new BufferedReader(new InputStreamReader(in)); StringBuilder s = new StringBuilder(); String line; try { while( (line = r.readLine()) != null ) { s.append(line); } } catch (IOException e) { e.printStackTrace(); } return s.toString(); }@
  • Debug work not release !

    4
    0 Votes
    4 Posts
    4k Views
    D
    I've tried @ QApplication app(argc, argv); QWidget fenetre; QTabWidget* onglets = new QTabWidget(&fenetre); fenetre.show(); return app.exec();@ Under Qt 4.8.1, 4.8.0 and 4.7.4 both debug and release, and it never crashes. So the error is probably in some other code. And quite frankly I don't see what should go wrong with the code you show. Normally it's not wise to pass stack pointers to heap allocated objects, but in this case It should be okay because it's the stack frame of main() which only gets unrolled on program termination. And since you're giving the pointer as QObject parent, this unrolling of fenetre should gracefully delete onglets, too.
  • QNetworkAccessManager: How to enable cookies / How to Facebook login?

    3
    0 Votes
    3 Posts
    6k Views
    N
    Thank you. It is as you said. I just had to use the same nam for opening the startpage and the login page after having assigned a CookieJar before. Works fine now.
  • Vertical alignment in QTextEdit

    1
    0 Votes
    1 Posts
    3k Views
    No one has replied
  • Qt property system: access enumerations as string

    3
    0 Votes
    3 Posts
    3k Views
    L
    Thanks! I'll give it a go.
  • [SOLVED] QSqlRecord and auto-increment primary keys

    6
    0 Votes
    6 Posts
    11k Views
    S
    I find the answer. No need to query last PK in table (in that case, DBMS should process almost half records in table by index). Just remove the PK from record. Not set it to NULL or '0' or set generated flag. Just remove the field from record: @ QSqlRecord newRecord = model->record(); newRecord.remove(0); @ :)
  • Parse CSV with comma inside fields

    11
    0 Votes
    11 Posts
    13k Views
    L
    [quote author="Skyrim" date="1338737081"]hi, Luca try this I read csv in QTableWidget [/quote] Thanks Skyrim but as DerManu wrote, It will break on @ "12345","ciao, mondo" @ DerManu, I didn't know nothing about "Chomsky grammars". Thanks for describing me this. So as you said, the only solution will be to parse by hand my CSV?
  • [Solved]QDomDocument

    11
    0 Votes
    11 Posts
    7k Views
    M
    Thx...in the end I used regular expresions (QRegExp) to extract what I need.
  • Significance of the following code

    11
    0 Votes
    11 Posts
    4k Views
    P
    Yeah Chris u were right....I gave some time to makefile (guess knew very little about it) had to made some very minute changes...now its working absolutely fine...Thank you so much for your help.... Looking forward for same ......:)
  • Problem with installing Qt 4.8.2

    4
    0 Votes
    4 Posts
    2k Views
    Y
    I don't use Qt SDK, i want to use Qt 4.8.2 and integrate it with Qt Creator 2.5. In the past(before Qt Creator 2.5), first i installed Qt creator and then Qt, when Qt asks for MinGW directory, i addressed MinGW that was in the Qt Creator directory. but in Qt Creator 2.5 MinGW is removed and i don't know how to install Qt 4.8.2 because it can't be installed with other MinGW except that is in the Qt Creator 2.4.1 and after installing Qt 4.8.2 in this way it easily integrates with Qt Creator 2.4.1 but doesn't integrate with Qt Creator 2.5. The problem:* I want to install Qt 4.8.2 with the right MinGW and integrate it Qt Creator 2.5*
  • Compiler needed

    4
    0 Votes
    4 Posts
    1k Views
    A
    Robert: On the Download page it shows the QT Libraries where it has a MingW compiler. The SDK download, at top of page, shows some info:- Complete tool chain - All you need: simulator, local and remote compilers, internationalization support, device toolchains and more. Which suggests it could have compilers in it. Thanks for your reply. ChrisW67: I will be using Windows to start with. Have just purchased a iMac and had Windows7 installed on it as well, which I have worked with for some time. Mac is new to me for now. I just need a simple install to Get Started for Windows with Qt. I notice several applications we use on ur computer are NOW using Qt which has bought my interest to Qt. Thanks for the replies.
  • [SOLVED]Again with arrow head, QTransform.

    2
    0 Votes
    2 Posts
    2k Views
    M
    I apologize, after I wrote above post, I realized that I must invert/normalize the angle by myself. I don't know why inverted() function inverted all QTransform, so below is the final (or part of) code: @ QLineF centerLine = this->centerLine(); qreal angle = centerLine.angle(); if (centerLine.dy() >= 0 || centerLine.dy() <= 0) { angle = -angle; } QPolygonF arrowHead; arrowHead.push_back(QPointF(0,0)); arrowHead.push_back(QPointF(arrowHead.first().x() + 5, arrowHead.first().y() - 5)); arrowHead.push_back(QPointF(arrowHead.first().x(), arrowHead.first().y() - 10)); arrowHead.push_back(QPointF(arrowHead.first().x() - 5, arrowHead.first().y() - 5)); arrowHead.push_back(arrowHead.first()); QTransform transform = QTransform().translate(intersectPoint.x(), intersectPoint.y()).rotate(angle - 90, Qt::ZAxis); QPolygonF transformed = transform.map(arrowHead); @ Note at the 15 line we subtract 90 to angle (angle - 90). Now we can add any types of arrow heads: @ QPolygonF arrowHead; arrowHead.push_back(QPointF(0,0)); arrowHead.push_back(QPointF(arrowHead.first().x() + 5, arrowHead.first().y() - 5)); //arrowHead.push_back(QPointF(arrowHead.first().x(), arrowHead.first().y() - 10)); arrowHead.push_back(arrowHead.first()); arrowHead.push_back(QPointF(arrowHead.first().x() - 5, arrowHead.first().y() - 5)); arrowHead.push_back(arrowHead.first()); @ @ QPolygonF arrowHead; arrowHead.push_back(QPointF(0,0)); arrowHead.push_back(QPointF(arrowHead.first().x() + 5, arrowHead.first().y() - 5)); //arrowHead.push_back(QPointF(arrowHead.first().x(), arrowHead.first().y() - 10)); //arrowHead.push_back(arrowHead.first()); arrowHead.push_back(QPointF(arrowHead.first().x() - 5, arrowHead.first().y() - 5)); arrowHead.push_back(arrowHead.first()); @ ..... Thanks, Mario.
  • 0 Votes
    4 Posts
    2k Views
    A
    There is a bit problem with @ ui- tableWidget->item( row, 0)- text(); @ the program crashes at this statement if the row is empty, if there is no text.
  • Question on QLineEdit

    2
    0 Votes
    2 Posts
    1k Views
    S
    check "QLineEdit::setPlaceHolderText()":http://qt-project.org/doc/qt-4.8/qlineedit.html#placeholderText-prop
  • Display update and infinite loop

    4
    0 Votes
    4 Posts
    3k Views
    D
    Yes, using a second thread for polling is absolutely okay, too. I just thought it would be easier for someone new in Qt to do it the QTimer way instead of the QThread way. But if you managed with QThread, great! :) (Of course, you should feel a vague sense of shame for CPU intensive polling, but if the serial library doesn't provide callbacks/events, you can't do it differently.)