this is my first QT designer project, and I haven't found an answer for my problem, I designed a dialog for QGIS, I included an icon, with the label display widget, set it up from the resource file, but it won't show in QGIS, at first it didn't even recognized the font and font size I set up in QT, but changing the style Sheet directly in the object inspector fixed that, now I just can't make the icons appear in QGIS, I tried .png and .ico and minimal size, I tried editing the .qrc and .ui file, but nothing works, do I need a python script for that?, what am I missing??
When I preview the dialog in QT it shows ok, and the deafult icons appear in QGIS
I am using QGIS 2.18 and QT designer 4.8.5
Thanks
After you have replaced the icon file you need to recompile with the command make
Related
I Have my project explored opened, and I notice that .py files and .txt/.csv ones share the same icon with the same color (see the image below). I would like to change the layout of it so that I can immediately see if the file that I am looking at is a program or a text file (for example, if the file ends in .py I would like to see it highlighted in red, if it's a .txt in white and so on), like the pycharm project explorer. Is there a way?
(Spyder maintainer here) There's no way to change icons or their colors at the moment.
However, we could improve the situation by assigning different icons to Python and CSV files. If you're interested in this possibility, please open an issue in our issues tracker.
With
void QApplication::setStyleSheet()
I can set a global style sheet for my Qt application.
For example, I set the default background of all QWidgets to black.
However, in the QT Designer all my widgets still have the default looks (grey background), because it doesn't know anything about my code.
Is there a way to set a global style sheet to my application that also affects the widgets looks in the QT Designer? Then I wouldn't have to compile my project every time I want to see how it looks.
Or is there maybe a more sophisticated way to solve this problem?
There is solution. You can set in Qt Designer your stylesheet for top level widget styleSheet property.
For example: you set style
QWidget {background-color:black;}
for MainWindow form in Qt Designer and all child widgets now have black background.
In the Preferences dialog (menu: Settings, Preferences...), there's a section in Forms called "Print/Preview Configuration". You can set a stylesheet there for the preview action (normally on Ctrl+R). This won't change the colour of the form as you edit it, but you can quickly see it as it will appear in your application.
See also my question Can I style the top-level form in Designer preview?
As you said yourself: It doesn't know anything about your code. So nothing you can do in code. But compiling your project every time you want to see how it looks? One stupid question... don't you know about the preview function in the designer? Press ctrl-alt-r.
Of course, it shows only the style, which is applied to the widget currently loaded in the designer. But you could temporarily set your style sheet to this widget to see how it would look, if you later on set this sheet globally in your program. Not perfect, but at least no need to compile your whole project.
I am using Qt5 and having some problems in setting the back ground image of a QPushButton. I am using Qt Creator and Design to drag and drop the QPushButton. After that I created a source folder and placed an image in that directory and I googled and tried doing
ui->pushButton_play->setStyleSheet(QString::fromUtf8("background-image: url(:/source/play.png);"));
but no success...am I creating the folder in a wrong place?..I created in D:\Qt5_PROJECT_NAME\source or will I make the url(:\\source\\play.png). Nothing is working...please help...
Did you add the images file into .qrc file? A URL start with : has indicated that It will be searched in .qrc file. If .qrc file didn't used, URL should not start with :. Maybe you should access the image file as
ui->pushButton_play->setStyleSheet(QString::fromUtf8("background-image: url(source/play.png);"));
This is The Qt Resource System documentation.
I've been tweaking my .ui files by hand a lot recently and I'm curious, does anyone know how to turn off read only mode for .ui files in Qt Creator?
In case that's not immediately clear, what I mean is that .ui files (by default) are view-able inside Qt Creator but not write-able... and it's a minor nuisance to go boot up some other xml editor :/
Thanks!
In the context menu of any .ui file in the project explorer, click Open With and then Plain Text Editor. This gives you the same editor but with write mode.
Note that the disabled write mode for ui files when double clicking and changing to "Edit" mode rather than "Design" mode isn't a bug but a feature. Editing ui files by hand can destroy your file. At least, this is what the Qt guys think...
I have written a program on XCode4, how can I change the icon of the program?
Refer to the screen capture below:
Also, what is the size for the icon?
Thanks
You put icon file into Resources folder, and then open .plist file (also in resouces folder). Set icon file name in properties list.