I'm back with a GPU.. Qt Creator still not working
-
@Mlibu said in I'm back with a GPU.. Qt Creator still not working:
@Tink Ok but the whole point to starting this thread is to find out how to use the plugin. From what you just said, creator is different so Design Studio is not an alternative. I have tried the plugin on OSes officially supported by Qt and they don't work so what can I try next?
You cannot use the plugin, it give you crashes. Luckily you can use design studio not only as an alternative but as the default recommended tool. Of course you also need to use q tcreator. You must use both tools. Good luck and have fun.
-
@Tink I guess I'm just surprised that for something that has obviously had an enormous amount of energy put into it and is so polished in so many areas, no one knows how to get this working. There must be some requirement that is not documented or something, and if I knew what that was I would get a system that could run it. Or maybe just replace a CPU. I thought that the kernel and OS was generally supposed to abstract differences in hardware, and my card should be supported and there is no 3d acceleration required here anyway. I've never encountered a problem where I couldn't get something to work like this before, save for things that were no longer under active support.
-
@Mlibu , You are so right. I have created applications just using the Qtcreator tool and python before . Now Qtcreator is just so buggy. If the plugin is there and is used quite prominently. It should work properly, at least for the new project that Qt itself creates , with default settings.
Design Studio doesn't solve my problem as well, I can't use it as a replacement for Qt creator. I need to be able to design and code the app .
-
@Momo007 I figured out how to add the function in Qt Design Studio. I will explain it for anyone else who ends up here. Apologies in advance if any of this is wrong or bad practice, but there was nothing else to go by.
Say your ui file is Main.ui.qml and it has a button, and you want to trigger a function with the onClick.
Now you need to switch things around because you want this:
MainForm.ui.qml = UI code
Main.qml = Override with anything that can't go in the ui fileTechnically the 'MainForm' name can be anything you want except for 'Main' so long as it is referenced by Main, but I think it is a good naming standard for clarity. So the first step is to rename your Main.ui.qml file to MainForm.ui.qml.
Now you need to create a QML file that will hold all your logic. I couldn't find a way to create a blank QML file in desginer really. I suppose I could have gone into the terminal and touched the file. What I did was just use File->New File..->QML Files->listModel. Name it Main.qml. Then when the component editor comes up just delete all the code keeping in mind to leave the import or add any others you need, and add:
MainForm { id: mainRoot }
Inside this object is where you put all your functions and any other things that go with the functionality of the UI. Note that you are instantiating the form component with all the real QML and anything you add to here will override that component. Moving along...
Now you need to manually add the onClick handler and the function.
So add the function to your Main component:
MainForm { id: formMainRoot function handleClicked() { console.log("HANDLE CLICKED"); } }
After I added the function I did not see it in the 'Connections' selection for the button until after I manually edited the button with it, though it may have appeared with time. It did appear after I made the setting in the code, don't know what magic happens in the background.
So you also need to modify the handler in the button manually as below:
Button { id: button text: qsTr("Button") Connections { target: button onClicked: formMainRoot.handleClicked() } }
This worked for me in the executed version.
My preferred way to do it though will be switched up, because it keeps all the manual editing out of the UI file which is the main intent, I think. To do it this way you need to make the button visible to the parent Main component which will allow it to modify the button.
Select your button in the 2D editor and click on the @ to the right of the id field. This will create an alias at the top of the component, thus making the button visible. I found that I had to do this through the UI rather than adding the alias code or the compile wouldn't work.
Now instead of modifying the MainForm file, just put it all in the Main component:
MainForm { id: formMainRoot function handleClicked() { console.log("HANDLE CLICKED"); } Connections { target: button onClicked: handleClicked() } }
I hope this unconfuses some people. I pieced this together through many bits I found on the internet. I do not know why this is not explained anywhere. Obviously you could adapt this to do basically anything you wanted.
It's quite a nice way to separate things, but at a cost of having to flip between two files all the time as well as flipping from 2D to code tabs, to get essentially one thing done.