I am currently working on a UI and I came open this issue with QT Creator.
When I try to create QtQuick apps on Creator, i get this error message.
22:36:00: Starting C:\Qt\6.1.0\msvc2019_64\bin\qmlscene.exe -I
C:/Users/fatih/Documents/untitled7/imports -I
C:/Users/fatih/Documents/untitled7/asset_imports
C:/Users/fatih/Documents/untitled7/untitled7.qml...
file:///C:/Users/fatih/Documents/untitled7/untitled7.qml:9 Type
Screen01 unavailable
file:///C:/Users/fatih/Documents/untitled7/Screen01.ui.qml:-1 Type
Constants unavailable
file:///C:/Users/fatih/Documents/untitled7/imports/untitled7/Constants.qml:8
Invalid property assignment: "name" is a read-only property
I am trying to fix this issue but I couldn't. How can I?
Okay I found the answer
Go to QT Creator Preferences (Menu Bar | Tools > Options)
Select QT Quick Option (Options headings - left side).
Click the QT Quick Designer tab.
Under QML Emulation Layer grouping, select "Use QML Emulation Layer that is built with selected QT".
No need to choose a path, just click Ok.
Related
When I create the "Command link button" (QCommandLinkButton) it has relatively nice green arrow icon.
I would like to see what other nice icons can I choose. When I try to change the icon, [Theme] appears instead of path or some GUI selection dialog:
I also noticed the context menu:
When I click Set icon from theme, again expecting some GUI selection list, I get just a text field:
What I was imagining:
Where's the list of icons from which the green arrow was taken?
QIcon::fromTheme works under specific conditions.
If it can find it in the QIcon::themeSearchPaths() for the QIcon::themeName()
If the desired icon isn't there, Qt Designer won't be able to do any of the from theme, named icons.
But... if you check your target system for the theme search paths and set the theme name, you are more likely to have success.
Example
On linux, I wanted to get a plus and a minus icon.
I found list-add.png and list-remove.png fit the bill.
https://github.com/GNOME/adwaita-icon-theme/tree/master/Adwaita/16x16/actions
http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
I did a locate on my system and found these:
/usr/share/icons/gnome/16x16/actions/list-add.png
...
/usr/share/icons/gnome/32x32/actions/list-add.png
/usr/share/icons/gnome/scalable/actions/list-add.svg
/usr/share/icons/oxygen/16x16/actions/list-add.png
...
Forcing with fallback icon in QIcon::fromTheme
Find the icon on the filesystem:
ui->toolButton->setIcon(QIcon::fromTheme("list-add",
QIcon("/usr/share/icons/gnome/16x16/actions/list-add.png")));
Find the icon in the qt resource system...
Add the icon in a qrc file in your build, then reference it's path.
ui->toolButton->setIcon(QIcon::fromTheme("list-add",
QIcon(":/list-add.png")));
Overriding the current icon theme
qDebug() << "themeSearchPaths:" << QIcon::themeSearchPaths() << QIcon::themeName();
// themeSearchPaths: ("/usr/local/share/icons", "/usr/share/icons", ":/icons") "hicolor"
The default theme for the system, and for the target deployment machine, likely didn't have the icons in it I wanted... but the gnome or oxygen icon desktop theme installed would almost always have it...
QIcon::setThemeName("oxygen");
Note that you won't see the preview in Qt Designer necessarily because it doesn't set the theme until runtime of your code.
The gnome icon library has 1100+ icons in it. Here is one list:
https://gist.github.com/peteristhegreat/c0ca6e1a57e5d4b9cd0bb1d7b3be1d6a
This works as long as you know what themes are available on the target system.
The list from freedesktop.org has 286 icons listed.
Use icons included in Qt
Just like #peppe pointed out, Qt includes 70 standard icons, too.
widget->setIcon(widget->style()->standardIcon(QStyle::SP_BrowserReload));
http://doc.qt.io/qt-5/qstyle.html#StandardPixmap-enum
Conclusion
Using a stock library on your target system is probably the fastest. Using the Qt built-ins is fast to figure out and use, but is fairly limited. Using a resource file is probably the most robust method, and gives unlimited options on what icon to use.
Be sure to pick a standard icon pack, and think about licensing and attributions, and some other things like that.
And there is no shortage of icons available online:
https://www.quora.com/What-is-the-best-icon-library
https://www.google.com/search?q=open+source+icon+library
Hope that helps.
I don't think that's the function you want to use. The "theme" name there corresponds to the QIcon::fromTheme functionality, which uses icons named according to the FDO specification
http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
And they're not really supported on non-FDO platforms (Windows, Mac, ...) unless you deploy your own theme files.
Now some stock icons are shipped with Qt itself; I don't know how to set them from Designer, but from code you can use QStyle::standardIcon:
widget->setIcon(widget->style()->standardIcon(QStyle::SP_BrowserReload));
If the icon you need is not provided by Qt, you'll need to ship it. In that case the Resource System is a convenient way to bundle it alongside your executable.
Last, but not least, from a UX point of view you should consider using QToolButtons unless you're really building a Vista-like wizard.
I built OpenCV 3.0.0 with Qt support (Qt 5.5) in order to try some of the advanced HighGUI features:
cv::namedWindow("Main", CV_WINDOW_NORMAL | CV_WINDOW_KEEPRATIO | CV_GUI_EXPANDED);
cv::createButton("test", buttonCb);
while (1)
cv::waitKey(1);
I expected to see a window called "Main" with a nice toolbar as well as a control panel containing a push button "test" (see here).
What I do get is a window called "Main" with a toolbar where the icons are missing (see screenshot) and the control panel does not appear at all.
What's wrong here?
Have you tried including GTK or VTK libraries in your CMake file?
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
or
find_package(GTK REQUIRED)
include(${GTK_USE_FILE})
If you build opencv as STATIC lib , try to build it as DLLs, not only icons appears but also the style of the GUI is much prettier. If you are not absolutely obliged to use opencv as static lib, this may be a solution.
The control panel is not shown by default, you can display it by right-clicking on your main window and choose the last entry of the menu, or just use the shortcut CTRL+P.
Suppose a Qt qmake project has a source with a following line of code:
loadTxt(":/libraryNotes.txt");
If I want to open the "libraryNotes.txt" files in the target's resources, I need to go the "Projects" tab, open the "Resources", and look for the file, then click and open it.
Is there any shortcut to do it directly from the code editor pane, when the mouse cursor or text cursor is over the filename? I'm thinking of a way similar to pressing F2 to follow the symbol to its declaration/definition.
Unfortunately, this doesn't seem to be supported in Qt Creator 3.2.2 at least. But it shouldn't be too hard to add, most of the support code is already there.
With Glade Designer that lets you set up Gtk-Ui's you can check the option that windows are not shown in the taskbar (unter linux, e.g. in Ubuntu this is the launcher on the left hand side). If I take a look at the ui-file generated by Glade, it says <property name="skip_taskbar_hint">True</property> However I believe that this option is not Gtk-specific, and want to apply this one on my PyQt4-app.
Right now I can only disable the window in the taskbar if i set the hint with the programm devilspie (that communicates with EWMH-standard) to skip_tasklist, which is too much for me.
Does anybody know such an option?
It seems that Qt::SplashScreen does the same effect. You can add this flag to your widget using the following code:
setWindowFlags(windowFlags() & Qt::SplashScreen);
Source
I'm teaching myself iOS programming and am trying to add a Settings Bundle Resource to my Hello World app, following instructions in the iOS Application Programming Guide. The Settings.bundle object is created in my project (with the disclosure triangle) but there are no files inside.
I expected a Root.plist and en.lproj/Root.strings
Am I missing something in my Xcode4 installation or Xcode setup?
Thanks!
If you click on it with the mouse, and choose "Show in Finder", and in Finder click on it and choose "Show Package Contents", you'll see that it's a directory.
(I found the answer at http://www.iphonedevsdk.com/forum/iphone-sdk-development/92361-settings-bundle-corrupted-newly-added-settings-bundle-also-bad-xcode-4-2-a.html )
[quote]
Click on the Settings.bundle file in the left window; from main menu choose View -> Utilities -> Show FileInspector. Then change fileType to "applicationBundle" -- the two missing files will show under Settings.bundle.
[/quote]
(FileInspector is the right column (to the right from the central view(s)), the tab with an icon showing a page with a paper-clip in the corner)
Just for completeness, this was fixed in a newer version of Xcode. I'll remember to include versions numbers next time.