Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • Qt supported html subset, RTL problem

    3
    0 Votes
    3 Posts
    2k Views
    kalmaK
    Hi! thanks for the reply here is a sample of the main part that I keep tweaking: @#include <QTextBrowser> void showtable(int lang) { QtextBrowser *textBrowser = new QtextBrowser; QString report; switch (lang) { case 0://Arabic { setLayoutDirection(Qt::RightToLeft);// works fine for layout only but not RTL text rendered insude QTextBrowser //-----------table header report = "<table width=\"100%\" dir=rtl align=right border=1 cellspacing=0 cellpadding=1>" //RTL bug??? "<tr><td align=center colspan=3><H3>"+tr("Media Details")+"<font color=red><b> [</b>"+name+"<b>]</b></font>" "<tr><td align=center bgcolor=\"#EBEBEB\" width=\"50%\"><b>"+tr("Details")+"</b>" "<td align=center bgcolor=\"#EBEBEB\" width=\"20%\"><b>"+tr("Logo")+"</b>"//make nicer //--------------details "<tr><td align=right>"+name+"<td align=right><b>"+tr("Name")+"<td rowspan=4 align=center valign=middle><img src='./medialogo.png'>" "<tr><td align=right>"+"Qtland"+"<td align=right><b>"+tr("Country")+ "<tr><td align=right>"+"info"+"<td align=right><b>"+tr("Content")+ "<tr><td align=right>"+"programming"+"<td align=right><b>"+tr("Genre")+ "<tr><td align=right>"Owner"<td align=right><b>"+tr("Ownership")+"<td></table><p><br>"; break; } case 1://English { //-----------table header report = "<table width=\"100%\" border=1 cellspacing=0 cellpadding=1>" // "<tr><td align=center colspan=3><H3>"+tr("Media Details")+"<font color=red><b> [</b>"+name+"<b>]</b></font>" "<tr><td align=center bgcolor=\"#EBEBEB\" width=\"20%\"><b>"+tr("Logo")+"</b>"//make this nicer "<td align=center bgcolor=\"#EBEBEB\" width=\"50%\"><b>"+tr("Details")+"</b>" //--------------details "<tr><td align=center valign=middle><img src='./medialogo.png'><td><b>"+tr("Name")+"<td>"+name+ "<tr><td><b>"+tr("Country")+"<td>"+"Qtland"+ "<tr><td><b>"+tr("Content")+"<td>"+"info"+ "<tr><td><b>"+tr("Genre")+"<td>"+"programming"+ "<tr><td><td><b>"+tr("Ownership")+"<td>"Owner"</table><p><br>"; break; } }//switch textBrowser->setText(report); } @ I didn't test it against Webkit. Thanks in advance
  • Svg 1.1 support

    2
    0 Votes
    2 Posts
    1k Views
    D
    The way is basically "code it yourself". QtSVG is deprecated/done, QtWebKit is the only supported solution for a full compliant SVG renderer...
  • QNetworkReply Error 299

    2
    0 Votes
    2 Posts
    9k Views
    D
    Check that the QUrl is actually valid. Also, you might want to use a network sniffer to see eventual differences in the traffic with wget or a browser, and QNAM.
  • Erase some area of the custom QGraphicsItem

    2
    0 Votes
    2 Posts
    2k Views
    N
    let me explain. I try to draw a cubic bezier and when i want to re-size this with control handlers the image below will apear. I try painter->eraseRect() function. but it dose not work.... !http://s14.postimage.org/br5hsabm9/Screenshot_at_2012_03_08_06_01_26.png(bezier curve drawing problem)!
  • How to make QQuickView TranslucentBackground

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • [SOLVED] programming 2D graphic project with C++

    7
    0 Votes
    7 Posts
    5k Views
    N
    thanks every one :D. I start with QGraphicsItem with my customs. Im trying to draw some special shapes. and I was successful :) thanks every one for help me... I use the qt tutorial and I found what I want (but not simple). thanks again for guide...
  • QProcess - starting Java app - wrong environment?

    12
    0 Votes
    12 Posts
    6k Views
    V
    For those who face the same problem: If you start a java application with QProcess it will start java with the same bitness of the Qt app! It means: if your Qt app is 32 bit and you run it on a 64 bit Windows it won't find the 64 bit Java, even if there's no 32 bit Java installed only the 64 bit! It will only find the 32 bit Java (if installed)!
  • Converting one element from a QString to int [SOLVED]

    7
    0 Votes
    7 Posts
    46k Views
    M
    Be sure and edit your first post to add [Solved] to the thread title! Thanks!
  • Writing application to cd(solved)

    10
    0 Votes
    10 Posts
    3k Views
    M
    Glad you found your issue. Be sure and edit the title of your post to add [Solved] to the beginning! Thanks!
  • Adding / appending two QTimes together

    5
    0 Votes
    5 Posts
    4k Views
    A
    QTimeSpan will not appear in Qt 4.8. There will only be bugfix updates for this series. It is also unlikely there will ever be a 4.9. Also, it will not be in Qt 5.0, as the feature freeze for 5.0 has already passed. So, the first version it might appear in, is in Qt 5.1. There is no planning yet when that version will appear.
  • Encoding and locale problem

    7
    0 Votes
    7 Posts
    4k Views
    J
    I never tried to decompress or compress anything using Qt, so unfortunately I can not. When you try with English text, you try using the same codec? And, are Russian characters even in ascii table?
  • Detect click event (signal?) of QGraphicsSvgItem

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Make Line Edit Uneditable and Change the background color

    6
    0 Votes
    6 Posts
    22k Views
    L
    [quote author="mlong" date="1331136920"]If that means that a particular button enables/disables a QLineEdit, then it makes sense. But if it means that you click a button to make the text something predefined (which just needs to be displayed) then it may not be the best solution. [/quote] Yes, absolutely. I totally agree that in the second case it would be better to use QLabel.
  • Chicken-and-egg problem with exec&#40;&#41;

    4
    0 Votes
    4 Posts
    2k Views
    B
    Turns out the SetFrontProcess() doesn't actually work, even when calling it after the widget is "running". Ended up using AppleScript: @ QString aScript = "tell me\n" " activate\n" "end tell\n"; QString osascript = "/usr/bin/osascript"; QStringList processArguments; processArguments << "-l" << "AppleScript"; QProcess p; p.start(osascript, processArguments); p.write(aScript.toUtf8()); p.closeWriteChannel(); p.waitForFinished(); @ Go figure...
  • Adding db to resources

    9
    0 Votes
    9 Posts
    7k Views
    G
    Good to know, I've updated the note.
  • Ready-available style themes?

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • QT dll question

    2
    0 Votes
    2 Posts
    2k Views
    G
    Regarding the Qt library DLLs itself: You need to install all DLLs corresponding to the Qt modules you use (QtCore4.dll, QtGui4.dll an probably some more like QtNetwork4.dll or QtXml4.dll). Assuming that you build you own DLL to add functionality to something, you will have to distribute that DLL and all DLLs it depends on. So, if you use some Qt code in your DLL, you will have to ship the Qt DLLs too (unless you can be sure that they are installed by the host application already). Using the code depends: If you can link against the DLL, you can use it just like the Qt API. If your DLL is supposed to be used by others, then just ship it together with a header file (.h) so that the users can link against the DLL. If the DLL is purely optional (linking against a DLL creates a hard dependency), you could build a Qt based plugin. The users then can load the DLL using QPluginLoader. There are some examples in the docs (plug and paint example).
  • How can we change the file path of ini file ?

    3
    0 Votes
    3 Posts
    2k Views
    A
    You will need to move the file using other code. The file will not magically relocate.
  • Defining Path

    2
    0 Votes
    2 Posts
    1k Views
    L
    It depens what event means to you. You can add different pixmaps to QIcon using QIcon::addPixmap() or QIcon::addFile() for different modes (normal, disabled, active, selected) and states (on, off) which are then automatically displayed when the QPushButton enters a specific state and mode. If an event is something specific to your application there is no way around using QPushButton::setIcon(). If you don't want to have different pathes all over you code you could for example use a central icon pool @ class YourClass { ... public: enum Icon { StateAIcon, StateBIcon }; QIcon icon(YourClass::Icon icon) { return ...; } ... void stateAEvent() { pushButton->setIcon(icon(YourClass::StateAIcon)); } }; @ use resource aliases @ class YourClass { ... public: void stateAEvent() { pushButton->setIcon(QIcon(":/icons/stateA.png")); } }; <RCC> <qresource prefix="/icons"> <file alias="stateA.png">someFolder/someFile.png</file> <file alias="stateB.png">differentFolder/subFolder/someFile.png</file> ... </qresource> </RCC> @
  • Highlight tree item

    5
    0 Votes
    5 Posts
    3k Views
    W
    Your explanation is a little confusing, but I'll give it a shot. I'm assuming that what you're trying to do is, based on certain criteria, highlight an element in your QTreeView. What I've found helpful in applying special attributes to elements in a QTreeView (or any of the Qt Model Views) is to add a delegate that draws the cell in a special way. I usually use QModelIndex::data and QModelIndex::setData to set and test these criteria. So, for example, in my delegate (see QItemDelegate and its examples) I may do something like @if ( index.data( Qt::UserRole + 5).toBool() == true ) painter->fillRect( option.rect, Qt::green); // that will draw the background cell in the special highlight color.@ One nice thing about this approach is that the QItemDelegate will only draw if the node is visible. You get that part for free.