How to specify Code Style settings in a Qt Creator `.pro.shared` file? - qt

I can see from the documentation on https://qt-project.org/doc/qtcreator-2.6/creator-sharing-project-settings.html how to create a .pro.shared file that standardizes Editor settings.
But: is it possible to standardize Qt Creator's "Code Style" settings in a .pro.shared file, and if so, what is the syntax?

There is currently no UI way of doing that, not sure if we will add one at some point.
So you will need to do this manually: Set it up for a user, close the project to make sure the .user file is saved and copy copy the file into a .shared file. Remove everything you do not want to share (keep ProjectExplorer.Project.Updater.FileVersion!), while keeping the XML structure intact. You are a developer, I am sure you will manage:-)
Oh, make sure to use the oldest Qt Creator you want to support (IIRC this was introduced in 2.5, so going older than that won't help) to create the template. Creator will upgrade settings while reading them but it can not downgrade, so .shared files that are too new are going to be ignored.

Related

How to use .ui.qml files from Qt creator version 6

I've been some reading/watching some tutorials here and there about qt quick and qml from last few days. But the user interface of qt creator, the boilerplate that it produces on a new qt quick project in each of the tutorial had been different. there's so much confusion.
I want to make a simple Hello World Qt Quick project, I followed this book from packt. (It has changed from the last time I saw it, but still doesn't work)
I added some a UI file, which added *.ui.qml and *form.qml files. Now if I edit .ui.qml in design, No change is reflected on any other file, but if I open some other file in design, it prompts me to use the .ui.qml file instead. The examples give an error "No Cmake config found". I'm using Qt6.2 on Arch/wayland, downloaded via installer.
How is it supposed to work? I have read this answer, and few others but I'm still confused.
Could you link to a proper tutorial, or a simple example?
The best way to think about it is that *.ui.qml should be used for UI elements and their settings. They should be about the structure, layout and styling of your UI. Doing that also happens to make the files presentable and editable in Creator's Design Mode since it simplifies the structure of the QML to the point where it can reliable present it and modify it.
*.qml files on the other shouldn't have UI elements and should instead primarily contain functions, properties and signal handers.
This pattern is sometimes referred to as "code behind". It sort of follows the same philosophy with HTML and CSS. Modern HTML documents primarily represent the structure of a page while CSS is placed in separate files to govern how they should be styled.
In this case *.ui.qml files contain the structure and styling while *.qml files containing the behavior. Creator will create a pair of them while adding a QML UI resource to your project where the .qml file inherits from the .ui.qml file.
Other than this inheritance and to encourage the code behind pattern, there's no real difference between a .qml and .ui.qml file. Creator will also try to steer you to the .ui.qml version of the pair when you go into designer to help encourage this pattern.
I will note that Qt violates this pattern a bunch all over their documentation and examples....

Use custom made widget in another project

I have come across this custom widget,
https://github.com/akontsevich/WidgetBox
however I am unable to work out how to use it in my current project.
I have tried including the files in my project, as well as including a .pri file in my project.pro but it won't.
How do you use custom widgets, (this one for example) in a project?
You've got two ways to work with that.
First look at the project file for the widget: WidgetBox pro.
Notice the lines:
TEMPLATE = lib
...
creator_target.output = WidgetBoxPlugin.dll
This means you can build a library from the project and use it inside yours (after including proper headers)
Another way would be to include all the sources from the WidgetBox project into yours and build them along with your source.
Which approach to use depends on your needs. If you don't plan to modify the widget building it once from the authors project should be enough for you.

How to hide a file in Atom

I have a really huge webpack compiled javascript file in my project, and I'd like for it to be hidden in Atom since I keep clicking on it by accident, making Atom freeze.
How do I hide specific files in Github Atom Editor?
A quick way to hide a file would be to add it to the ignore-list in settings (open preferences, go to settings, under Core Settings you'll find Ignored Names).
Then to hide those from the tree view go to Packages, search for tree-view, open it's settings and make sure that Hide Ignored Names is checked.
If you're using a git-repository, for example, and don't need the file to be checked into the repository, it'd be cleaner to just add the file to .gitignore. Atom respects git-ignores and also hides them from the tree-view (as long as Hide VCS Ignored Names in the tree-view-settings is enabled).

How to get Plone's CSS Registry to load new CSS files

I'm trying to upgrade a Plone 3.3.5 server to 4.3.6. However, when I update the site, I find that the CSS for the site is not carried over. If I go to my CSS Registry, I find that almost all of my CSS is producing the (resource not found or not accessible) error.
My confusion seems to be in how Plone locates and links/imports stylesheets in general as Plone seems to be loading virtually none of my CSS and pretty much giving me raw HTML in the browser. I'm assuming the CSS registry is loading CSS from the buildout-cache. With this assumption, an example stylesheet that I'm targeting is located under:
Plone/buildout-cache/eggs/Products.NuPlone-1.0b3-py2.7.egg/Products/NuPlone/skins/nuplone_styles/base.css
When the CSS Registry failed to load this, I noticed that some CSS was being loaded in via handles like this:
++resource++tinymce.stylesheets/tinymce.css
But this format doesn't work with base.css and others.
So my question is, given I've got a new product installed with some CSS included in it, how do I get Plone to target said CSS?
For resources inside "skins" FS folders, the way to register on portal_css tool is to simply provide the filename, so simply put there base.css.
If this is not working probably the nuplone_styles skin folder is not registered properly in the portal_skins tool.
So go to ZMI --> portal_skins --> click on "Properties" and check the following:
what theme is used? You must probably switch back to NuPlone (but I'm not sure if it works on Plone 4)
is the nuplone_styles folder in the list of CMF layers of the used theme?
Please note also that adding the nuplone_styles layer to another theme is not a good idea. Please think about copying CSS you need in the custom directory.
This is not an answer, but some additional explanation, not fitting in a comment:
The "old" way to include style-sheets via skin-folders, requires to specify only the file-name, not a full path, and will be found by traversal, meaning the first found file with the according name, will be taken. In case of several files with the same name, the order of skins matters.
The other way is to register style-sheets via a browser-package, to have an unambiguous path to a certain file, they must start with +++resource++.

Project or Workspace specific Indentation in Xcode4

Is there any way to setup different indentation values for a specific project or workspace?
I've started working on a new project that uses a different indentation level then I've been using, and I would love to be able to set a custom value for that project, or setup a workspace for it, so that I don't have to think about changing indentation values when moving between projects. I've searched around but haven't had any luck finding any discussion about it.
I came across this question/answer: Is it possible to set indent settings in Xcode per project (or per file, even)? This is the exact same problem that I have, however the solution does not seem to be available in Xcode 4.
Open the file inspector by choosing View > Utilities > File Inspector. Select the project file from the project navigator. Use the Text Settings section in the file inspector to set the indentation for the project.

Resources