QVision Widget Error upon compile - qt

Only one error to go until I get to use this for my research!
Warning: Z-order assignment: " is not a valid widget.
FILE: qvvideoreaderblockwidget.ui
There's no line number that came with it. I tried finding but, failed to see an open-ended part.
What should I do to correctly compile this library?

Edit the ui file outside of Qt Creator. Delete the rows with 'zorder' tags. Then open in Qt Creator and compile again. It worked for me then perfectly, the warning did not appear any more.

OK, I had this, and it irked me too. I don't know what happened to cause this, but it is not serious. I suppose that breaking and remaking all the layouts might fix it. Other frameworks tend toward a lot of warnings, but tho I'm new to Qt, not a one yet. I went in another editor, and removed a line that said (as best I can remember):
<z-order>verticalSpacer</z-order>
which was among a lot of other lines which also were z-order tags. I deleted the line with this tag, and rebuilt all. Problem gone. Interestingly enough, all of the z-order tags had vanished from my file when I looked at it next. It must be a bug, but evidently one of little consequence; except those who hate to see the serene beauty of Qt spoiled.

Does the ui-file qvvideoreaderblockwidget.ui contain "Promoted widgets"? If so, use the "Promoted widgets" dialog of the (Qt4-) designer for ensuring that the header of the promoted widget-class is declared as "global include".
In case the custom widget class is named "MyWidget" and the header is named "mywidget.h" and the member widget shall be named "myWidget", the uic will generate the code of the ui-class as follows:
#include <mywidget.h>
class qvvideoreaderblockwidget
{
public:
MyWidget* myWidget;
// ...
};

It happened to me when I deleted a fairly large chunk of stuff in the designer. Investigation showed that the designer had failed to remove a zorder tag relating to the widget I deleted (which, incidentally contained a bunch of other widgets).
Deleting the line as suggested cleared the problem. If you do have a load of zorder tags you probably need to be careful to just delete the one that relates to the deleted item.

I had the same problem, and deleting the .exe file from the output folder (debug or release) before run/compile the source, solved the problem.

This problem arises due to a (presently) unfixed bug in Qt Creator's undo / delete mechanism.
The solution until the bug is fixed is to:
Close the .ui file in Qt Designer
Open the .ui file in an external editor
Delete the <zorder> line(s) that apply to the element with the problem. For example:
<zorder>groupBox_2</zorder>
Save the file
Re-open the file in Qt Designer
Re-compile in Qt

Related

Can I globally switch to native text rendering in Qt Quick Controls 2?

I would like to use native rendering for all the text in my application. For each Text, Label, etc. element I can do this
Text {
renderType: Text.NativeRendering
}
to trigger native rendering. I can also use the software renderer for the whole application:
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
However due to some bugs with the software renderer and some performance issues, I would like to avoid that.
Is there a global switch to change the render type?
Since Qt 5.7, you can change the default Qt Quick text render type, but unfortunately only at build time. In order to change the default, you would have to rebuild libQt5Quick.so with QT_QUICK_DEFAULT_TEXT_RENDER_TYPE set to NativeRendering. For more details, see https://codereview.qt-project.org/#/c/121748/ .
If you have installed Qt using an installer from qt.io, install the source packages using the maintenance tool if you already haven't done so, navigate to qtdeclarative/src/quick, run qmake with the define, and build. Something along the lines:
cd path/to/Qt/Sources/5.8/qtdeclarative/src/quick
# NOTE: make sure to run qmake from the same/correct Qt installation
path/to/Qt/5.8/<spec>/qmake "DEFINES+=QT_QUICK_DEFAULT_TEXT_RENDER_TYPE=NativeRendering"
make -jN
If you have a self-built Qt installation, invoke make clean (or if you want to save time, just delete qquicktext*.o) before make to rebuild the library.
EDIT: Since Qt 5.10, it is also possible to specify the default text render type in C++ via QQuickWindow::setTextRenderType(). Just notice to set it before loading the QML content.
The environment variable QML_DISABLE_DISTANCEFIELD controls this.
If you put
qputenv("QML_DISABLE_DISTANCEFIELD", "1");
at the beginning of your main, you will get a nice and sharp text rendering everywhere.
Source: http://www.kdab.com/~thomas/stuff/distancefield.html
Add this line first in c++ main function : QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);

Change virtual keyboard to AZERTY

I have a javafx application that is supposed to run in fullscreen mode on a Windows tablet.
My problem is, when the keyboard appears, it's in QWERTY whereas my tablet is in AZERTY.
So the question is : Is there a way to use the system virtual keyboard or to switch the javafx virtual keyboard to AZERTY?
I found you question while trying to accopllish the same thing.
I spent a day trying to make javafx display an AZERTY keyboard and i found a solution!
Well let me be clear : javafx gave no way at all to have an azerty keyboard so you have to hack a little.
The solution bellow is not a perfect one and you'll have to repeat it each time you update javafx, but it will allow you to extrem customize the keyboard far beyong querty and azerty.
SOLUTION 1 (dirty but works )
You will need to edit a file in javafx file shipped with the JDK
STEPS :
GO to the JDK (in Mac : /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home)
Go inside jre/lib/ext and copy javafx jar called jfxrt.jar to a folder on your desktop.
Install EMACS if you don't have it and open the copied jar file with this software
Browse files list searching for com/sun/javafx/scene/control/skin/TextBoard.txt
the list is sorted from A-Z so use it (there is more than 6000 files).
Open it and HERE you are. Change characters to whatever order makes you happy. I joined the azerty order.
Save and copy back the jfxrt.jar to where it was. Done.
Note: don't try to extract the jar and rezip it, it won't work as jdk keeps an index list of files.
Result:azerty javafx virtual keyboard in action
SOLUTION 2 (Clean but i didn't finish it)
Whene i digged into javafx classes i found out that the class responsible for loading the TextBoard.txt file that lays out the keyboard is FXKVSkin
This class is meant to receive other type of keyboards than the lonly qwerty default one.
All you have to do is add this in your code :
textFieldThatYouUse.getProperties().put(FXVK.VK_TYPE_PROP_KEY,
"mykeyboard");
Where mykeyboard is a file you created like TextBoard.txt called MykeyboardBoard.txt (capitals letters are important).
FXKVSkin will look now for a file called MykeyboardBoard.txt, and here's where my adventure ended.
You will need to make FXKVSkin find your file, i tried by adding a file to the classpath at runtime solutions Here but it didn't work.
If anyone can solve this problem, please add it as an answer, it would be a less dirty solution.
Hope the solutions will help some non english speakers! :p
The definition of the layout is contained in jfxrt.jar (part of the Java install). It is described by TextBoard.txt. It is possible to browse in the jfxrt.jar with 7zip or similar programs. TextBoard.txt is in com/sun/javafx/scene/control/skin/
This file is loaded com/sun/javafx/scene/control/skin/FXVKSkin.java is responsible for loading the TextBoard.txt file. Browse the javafx source (included via the jdk and contained in javafx-src.zip) to see how it is processed. Maybe this will give you enough information to load your own TextBoard.txt file.

How can I get a QFileDialog to prompt for overwrite?

I have a QDialog that opens a QFileDialog like so:
QFileDialog fd(this);
fd.setFileMode(QFileDialog::AnyFile);
if (fd.exec()) {
// save data to a file
}
Unfortunately, the default behavior doesn't seem to be quite so default, and the file dialog doesn't prompt me about overwriting if I select a file that already exists. Calling setConfirmOverwrite(true) or setOption(QFileDialog::DontConfirmOverwrite, false) first doesn't help either. I've tested this both on Qt 4.7.3 and 4.7.4 on both Ubuntu 11.04 and Windows XP.
I looked around and found this bug report. QFileDialog::getSaveFileName() had this issue, but it was specific to Maemo and fixed well before Qt 4.7.3 came out. If I use that method in my application it works just fine, I get prompted about overwriting the file. (I don't want to use getSaveFileName() for unrelated reasons.)
I can't find anyone else complaining about this not working for them. Am I doing something wrong, or is this a bug? I think it might be due to the dialog not knowing whether it's just a simple Open dialog where prompting wouldn't make sense, but I don't see a way to tell it it's a Save dialog (beyond setting the confirm-overwrite option, which fails), and the documentation does say it should prompt by default.
You should also be sure that the dialog is in save mode, as it will not think you are overwriting a file when in open mode. You can do this by calling fd.setAcceptMode(QFileDialog::AcceptSave); in your code example. See QFileDialog::acceptMode.

Could not resolve * to a component implementation

I'm a wee bit stuck on this, and was hoping you might have some input to help me.
I'm getting the "Could not resolve * to a component implementation." error message. However, everything I've read about this via Google hasn't helped my case in the slightest. I presume I'm just missing something obvious, but maybe its something more serious.
So, to solve this problem, I've tried two things, and both work, as far as they take me. First, I added a new component, of the exact same variety, and then copied the contents of the erroring component into it. I replace the viewstack 'page' with the new component (which as near as I can tell is IDENTICAL, but with a different name), and the compiler error goes away.
I can also solve this by simply renaming the original component & letting FB4 refactor for me. The error goes away again. But if I then re-rename back to the original name, I get the compiler error again.
I've tried to clean the project several times, and that doesn't help. Neither does deleting the workspace, and re-importing the project.
I'd really like to understand what I've done wrong here. What am I missing?
Thanks much!
Try the following:
Right-click on your project in the
Package Explorer.
Select "Properties" in the pop-up
menu (last item).
Click "Flex Library Build Path"
Click the "Classes" tab
Try to find the name of your new component in there. If you do, see if it is checked or not. If it is not, check it. That should solve the problem right there, but you may have to clean and (sometimes) quit FB4 and relaunch.
Usually errors like this means you have two components named similarly and the compiler couldn't tell which one you wanted to use.
Do you have another component with the same, even in a different package? Or do you have a variable in your component the same name as the component? Be sure to check your SWCs and/or Library projects.
I'm assuming this is a compile time error; is that correct?
In my case the problem was solved by changing the SDK version of the Flex Compiler to 4.5
You can try with different SDK versions, until you get your component to compile or until the error changes to something related to a theme related error.
After changin this I got an error related to a propertie that is not supported by the current theme, so I open the component in design view and in the Properties View selected the Appearance tab and changed the theme from SPARK to HALO
Hope this is usefull for somebody else
One cause of this error is that the default xml namespace for the component is not the same as the the package in which the component resides.
Check to make sure that the default xmlns entry in the component definition is the same as the package.
For example:
If you have an component MyControl.mxml located in the package com.company.components.controls
The mxml opening tag might look something like this:
<MyControl xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:util="com.company.components.util.*"
xmlns:components="com.company.components.*"
xmlns="com.company.components.controls.*">
Note how the default xmlns entry points to the same package.
Why this happens:
What often happens is that after you refactor an MXML class by moving it to a new package you will end up with a an valid but not correct mxml definition.
For example say I refactor and move the MyControl.mxml from the com.company.components package to the com.company.components.controls package. The xmlns definitions will not be updated so they will look like this:
<controls:MyControl xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:util="com.company.components.util.*"
xmlns="com.company.components.*"
xmlns:controls="com.company.components.controls.*">
Note how the default namespace still points to the com.company.components package and the mxml tag MyControl has to be prefixed by the namespace controls this is an indication of the issue.
Now here is the catch; This is technically valid and will often work. The reason is that it is valid and the components can all be found in their defined xmlns locations.
The problem comes when you try to use a component that is expected to be found, by the framework or parent component, in the default namespace. A good example of this is and other subcomponents of the parent mxml component you might be extending.
To fix this you should modify the mxml tag and namespaces so that the default namespace is the same as the current package. (As in the first example)
Might be I am very late to answer this question, but this might be because the package name which is associating with your class is not the exact and appropriate.

Designer files not nesting correctly, messing up intellisense in Visual Studio

Greetings.
I've got a web site project loaded into Visual Studio 2008. The .designer files for all of my ascx controls are not nested under the control in solution explorer, and when I reference something in that control in the code behind, I don't get intellisense.
I've checked the csproj xml file, and the 'compile' elements appear to be the same as those in my other projects where this is working correctly. An example looks like this:
<Compile Include="Default.aspx.cs">
<DependentUpon>Default.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Default.aspx.designer.cs">
<DependentUpon>Default.aspx</DependentUpon>
</Compile>
I've tried playing with the project file, using the Website\Nest Related Files menu command, and everything else that I can think of. Any ideas?
UPDATE
Note that I'm trying to nest files that should be nested already.
This is a response to my own previous post. Got MS Tech Support to straighten it out. On my .aspx pages changing line one in 2 places solved the issue for me.
In the line in each .aspx file in your project that starts "<%Page Language" change "Codebehind=" to "Codefile=", and in your "Inherits=" property if it's set up as ProjectName.FileName then remove the "ProjectName.".
For example if you had a Project named "TestApp" and a file inside it called "NewFunctionalityTest.aspx" change
Inherits="TestApp.NewFunctionalityTest"
to
Inherits="NewFunctionalityTest"
in the first line.
To nest resx files you
Add Existing Item. Add resource and designer files to the project.
Select all resource files (Not Designer files) that are not nested.
Select Properties and change the Custom Tool to PublicResXFileCodeGenerator
Should work
Made sure both partial files are the same namespace and class name? Might also try to remove them and add both files back at the same time.
I ran across this macro a while back to do exactly what you're looking for. The author even posted a video of how to use it. I have never tried it though, so I can't vouch for it.
I don't know if the OP ever fixed his issue, but something very similar is happening to me. The designer.vb files aren't nesting, Intellisense isn't working, etc... The main difference is that I'm not using ascx, I'm using straight up .aspx pages with .vb codebehinds. It appears as though all the controls placed on the aspx page do not appear to VS as declared when I go to manipulate said controls in the codebehind. I get an error list hundreds deep from code I wrote months ago (having no problems with at the time), most of them saying "Name 'objectname' is not declared" where 'objectname' is a textbox, or dropdown menu from the associated aspx page. To answer Vishal's questions...
Can you share whether this happens everytime you create a new project or is it for a specific project...?
It's happening to one project. I have multiple other applications in VS2008 showing no problems.
Did you try compiling the project?
Yes, when I compile it lists out all the build errors that show up in the ErrorList aborts, and kicks over to the ErrorList.
Does intellisense come back after compiling
No.
A little more information on this project: It's a converted VS 2003 project. These problems did not start immediately after conversion from 2003. The conversion happened months ago and I made numerous revisions to the web app since then. There's currently a version with those revisions on a test server to show off new functionality to the client. This problem only cropped up 3 business days ago when I went in to make a few formatting changes to the aspx page. I never got a chance to make those changes however because as soon as I opened the project I got the error list. This issue is affecting every aspx page I have in the project.
I do not think the nesting is an issue for you, seeing nested files is just a eye candy although depends upon matters...
Not getting intellisense is not really a factor of nesting but rather something to do with the way references are hooked up for your project... Can you share whether this happens everytime you create a new project or is it for a specific project...?
Did you try compiling the project? Does intellisense come back after compiling... Typically for WAP projects if for somereason intellisense does not become available it should come after you compile the project...
Let me know if are still facing this issues...

Resources