I am trying to learn Qt version 6, and I'm at a point where my book has me importing QtQuick Controls. The book says to click on the "Imports tab" in the Library pane, and shows a screenshot containing the tab. (Virtually every web source I've been able to find says the same thing, with a similar screenshot.)
Unfortunately, my installation of Qt-Creator, version 4.15.1, installed with Qt 6, does not have an Imports tab on the library pane. This is what my Library pane looks like:
Yes, it appears that the controls have been imported, but I didn't do it through the UI, it happened during an experiment. What got the controls imported was:
I hand-edited the .ui.qml file to add the line
import QtQuick.Controls 2.4
I built the project
This resulted in the QtQuick controls appearing in the Library pane.
Surely this is not the normal way of importing controls, is it?
If I'm understanding correctly, you want Qt Design Studio to import modules for you from the UI.
Simply click here then:
Also, if your project was made with Qt6, there's no need to add the version in the import statement.
I hope I was of any help :)
Related
I wasn't able to create and use a QML component library by following the fragmented parts of tutorials and Qt documentation, so I'm just gonna ask somebody to answer it all at once.
I want to create a single file (located in /usr/lib/project/components.rcc), that will include all components in ~/Project/src/components/ and their child components located in ~/Projects/src/components/insertparentcomponentname/. I want to be able to use those components in normal QML code.
The question is, how can I create this file and how can I import components in it to use in QML?
( Using Qt Quick 2.0 and C++ with CMake on Arch Linux )
I have a problem:
I need to use DropShadow effect from QGraphicalEffects (which deleted in qt6) in my app.
How I can do it or replace it?
You can still import GraphicalEffects from the Qt5Compat module:
import Qt5Compat.GraphicalEffects
However you first have to install the Qt5Compat module from the Qt installer, which long term might not be what you want in new code as it is going to go away eventually.
I've been at this problem trying to find workarounds for weeks now and I am starting to give up. I must be doing something fundamentally wrong. Anyway, this is my situation. I have previously made a neat little program using JavaFX but have now discovered Scene Builder and want to build it all again using this tool. The project includes several components that are frequently reused such as the one below. This is made up of a label, a slider, a text field and another custom component, an InfoIcon.
I have understood that the done thing is to import the custom component (the InfoIcon) as a .jar file into Scene Builder when building my SliderVariable as I call it. This works great and I can run a small demo of my SliderVariable from within Eclipse by creating a main method, a scene and making a SliderVariable in this scene. As mentioned this works great. Importing or Including the InfoIcon does not do what I want (I don't think) because then I cannot easily make changes to the InfoIcon (or its controller) and update my SliderVariable and then see the effects in the final product.
The problems arise when I want to take it one step further and in turn use my SliderVariable in Scene Builder. I do as with the InfoIcon. I export my slider variable to a non-executable jar and then import it into Scene Builder. Here Scene Builder complains that it cannot find any UI components and thus fails to import it. I have discovered that this is because when I export the SliderVariable as a jar it does not also package its dependencies meaning the InfoIcon doesn't get bundled with it and that the compiler cannot find this component as I try to use it.
I have tried to solve this with FatJar which I cannot get working (and it seems like it is not in use any more). I have tried Maven where I couldn't import the Maven project dependency of the InfoIcon in the FXML of the SliderVariable. Finally I have also tried simply not importing a jar but instead including the source code of InfoIcon in a separate package of SliderVariable but then I couldn't import it into my FXML. I am desperate. What do people normally do if they want to reuse custom components with their own controllers in Scene Builder? Is this even done? Should I just give up :'(?
This unwieldly post must be highly confusing but I do not know how to make it clearer. Any sort of response would be greatly appreciated and if you do not believe this forum is the right place to post something like this (which it probably isn't) please point me to someplace else where I am more welcome.
Many thanks.
EDIT 1: I have now added a folder in my project called Dependencies. In here I put a copy (not a reference to) my InfoIcon.jar.
I then add this .jar file to my Build Path and remove the old one. I then enter SceneBuilder and reimport the InfoIcon jar but this time from the Dependencies folder I just created. At this point the small project test I've made still runs fine. I then export as JAR file with the following settings and hit finish.
I then try to import it into Scene Builder and Scene Builder tells me it cannot find any UI components.
EDIT 2: Should I select these items?
Note that the jar file is in Dependencies but also in Referenced Libraries (which is not visible here). This type of selection makes it so that Scene Builder can find and Import the InfoIcon but not the SliderVariable.
When you export InfoIcon, you can simply select the packages and classes related to it in the Eclipse's package explorer (or other similar explorer views), and choose export.
Similarly, when you try to export SliderVariable control, you need to choose everything you have selected in InfoIcon, on top of other files that are needed by SliderVariable control itself.
If InfoIcon is imported into SliderVariable project as a JAR file, then you would need to manually select that JAR file during the export of SliderVariable.
I want to create a TextArea in JavaFX with line numbers.
I think RichTextFX is want I am looking for but I don't know, how to import the classes in Netbeans correctly.
Following lines of code are from the XMLEditor.java demo:
import org.fxmisc.flowless.VirtualizedScrollPane;
import org.fxmisc.richtext.CodeArea;
import org.fxmisc.richtext.LineNumberFactory;
import org.fxmisc.richtext.StyleSpans;
import org.fxmisc.richtext.StyleSpansBuilder;
The last four import instructions are from project RichTextFX, and the first is from project Flowless. Is it sufficient to copy those 5 classes to my default package? Or should I download both projects, zip them to JARs and add them as a libraries?
In order to use RichTextFX, you need to add the whole library together with its dependencies. You can use a build tool with dependency management, such as maven, gradle or ant+ivy. Check the RichTextFX github page for more details.
If you want to do it manually, the easiest way is probably to download a "fat jar" from the RichTextFX releases page and add it to your project. It should include all the dependencies.
Today's my first day with Flex and FlashDevelop. In my ActionScript file, I have this line.
import flash.display.SimpleButton;
FlashDevelop is aware about this and Code-completion works fine.
But, when I have this line.
import mx.controls.Button;
Then code-completion doesn't work.
Works perfectly well for me w/o doing anything special. But maybe your project's properties got borked. Do this:
Open Project Properties
Go to Compiler Options tab
In Advanced -> Intrinsic Libraries add the following
Library\AS3\frameworks\Flex3
I had the same problem. Your AS3 class path is pointing at a directory to low in the flashdevelop library folder structure to pick the mx class prototypes.
1.) Within Flashdevelop press F10 to open the 'Settings' window.
2.) In the list on the left click on the 'AS3Context' option.
3.) Imediately Under the group title of 'Language' on the right hand side of the window, find the 'AS3 Classpath' option. Its value is typically set to 'Library\AS3\Intrinsic'. Change the the 'AS3 Classpath' value to read 'Library\AS3'.
4.) FIXED. Flashdevelop should now be aware of the mx libraries, thus autocomplete should now also work.
To include any swc to code complete, add it's parent folder to the swc libraries option. Some people claim that using intrinsic libraries works, but it didn't for me. Here's the paths to both settings:
ProjectSettings->CompilerOptions->SWCLibraries = {path to FOLDER containing swc's}
ProjectSettings->CompilerOptions->IntrinsicLibraries = {path to same FOLDER containing swc's}
It seems like you are missing the Flex framework in your build path. Have you looked at the libraries being included?