Qt form embedded in GUI results in shrinking to minimum size - forms

So I have this GUI .ui file made with Qt, which is embedded inside a sidebar on some Qt app I'm working on. Problem : it gets shrinked to an unsuable size.
My ui form starts with a QWidget, which is the main and base area for adding more things. This is set to be a grid layout (I didn't insert a grid layout manually, I just set the base QWidget to have one using the dedicated button at the top).
And it contains one thing only : a tab widget with all my stuff inside on two tabs.
And that's it.
Of course I did play with the size policy of everything, it's all set to Expanding and all.
This form is embedded by code into a larger tab widget. There is a new tab for every new form, I have like 10 different forms like this one.
Some actually have a QMainWindow at their base, and are not shrunk to death. I don't understand the difference, but I when I set my base thing to be a QWindow, the form does not shrink.
I also have one form in another tab that has a QWidget at its base and is not shrunk to death.
Any other information I could provide to help you guys help me ?

Related

MS Access form not centering properly across different monitors

I have an MS Access form where I have the main navigation page set to be centered and it works... kinda.
This form file has to be used on monitors of many different aspect ratios: 3:4, 16:9, and 21:9. When the form opens, it is properly centered in whatever window it opens. But when that window is then maximized, it doesn't re-center and instead sticks to the left side of the screen. Sometimes if I move it between monitors, the form is far 'off screen' in its own window and I have to scroll in the form to bring it into view, then it's stuck on the right hand side of the form.
Is there a way to force the form to re-evaluate what "centered" means?
It depends on how you are centering. The easiest way for objects to be dynamic is to use the form layout tool called "Anchoring". I like to make my layout expand to fill up the window to allow centered objects to remain centered as the window changes.

Binding to custom built control according to different data

Here's the issue, I build a special book reader/browser (For holy quran), my code behind loads the page and constructs how it should look. and then it should bind that look to a some kind of data-bindable custom control to view it properly. the problem is, the look differs from page to page, so I cannot bind to a certain control or wrap panel.
here's how it generally looks:
The decorative border top of the page is always there at any page, it indicates the part and chapter the viewer is in.
If you're starting a new chapter it have additional image under that decorative border or anywhere in the page (there can be multiple chapters in the same page) something like this
or this:
The normal text is not an issue, it's just a special font, however, I put each individual word in its own text block for reasons of user selection by word.
The issue here is, given the previous information, and knowing how random it is to place the decoration picture or the amount of words (text blocks) per page. how can I bind that to some kind of view to separate the view from the VM and Engine that builds the page.
my past solution was to actually build everything in the VM in a wrappanel built inside a scrollviewer having lots of textblocks and images according to the page. but that's naiive solution. I want to rebuild that in a more professional separated way. I also want to do this for Windows RT beside Windows phone so I need to reuse the code behind in a Portable class library.
I think all you need to do is slightly adjust your current design. So perhaps have a VM that represents the entire content, and that would have a Collection of say Pages or Sections. A second VM would represent the Page/Section, allowing you to create a property for the WrapPanel content (i.e. the words) and another property for the Header and or other things.
In the View you would have the scrollviewer and bind to the main VM collection. Then create another View or DataTemplate that represents the Page/Section.
You should be able to do this is a strict MVVM sense quite easily and it will be dynamic based on the content.
You could even cater for advanced scenarios where each section has a different template/view.

Make Dynamic Forms

I'm using Centura / TeamDeveloper 6.1
Is it possible to make the content of a Dialog / Window dynamic?
For example if I load a table inside a tab it is dynamic because the child table always takes the size of the tab.
I want the same behaviour with buttons etc. not that they always change size but that they move their position to stay like in the center no matter how far I resize the window without me having to write a function that calculates everything and that moves them around.
In C++ / QT I would use Layouts.
As it is right now I maximize the Window but the design is stuck on the left side.
Team Developer does not offers support this feature in native way.
however you can design your app to capturing when the formwindow size change and so your visual objects can change their position according the new container size.
there are some samples demonstrating this behaviour.
please, do a search here for "resize" samples

How to make breadcrumbs responsive?

I have used bootstrap3 for RWD and customized my breadcrumb. But, it's not fitting in mobile size.
How can I make it responsive?
Attached screenshot of the problem.
Thanks
I have created a snippet on bootsnipp that may fit your needs.
http://bootsnipp.com/snippets/featured/responsive-breadcrumbs
You can configure this breadcrumb to
display only the last n elements. Ellipses are added at the beginning of the list if elements are hidden.
set a maximum size for each elements. Ellipses are added after the label if it's too long.
By setting breakpoints you can set the number of elements to display and their maximum size for different screen sizes and hence make sure there won't be any overflow.
You are going to have to code that yourself. Without your specific code, no one will be able to give you specific answers. That being said, here is how I would get set up to add custom code to my Bootstrap website.
Using less
First, create a new .less file - this file will be your new primary style sheet. In that file, import in the bootstrap.less file. Compile that file and link it in your HTML files. You should now have an exact copy of the out-of-the-box Bootstrap CSS, with access to all of the Bootstrap variables.
To make any additions, add them to that file underneath the import statement. So in your case, I would grab the variables for the media queries and breadcrumbs (found in variables.less), and customize the style of the breadcrumbs at smaller screens.
Note that Bootstrap is mobile first, which means that the default styles will be applied at the smaller screen, and you override for larger.
Not using less
If you are not comfortable using less, I would say this is a great opportunity to start. That being said, if you want to do it the old fashioned way, then just create a second style sheet that you link in, add it underneath the Bootstrap sheet, and code away.

How to set initial size of a TreeViewer?

I'm using a TreeViewer within a jface WizardPage and the initial input into the tree causes the WizardPage to grow vertically so that it can show all of the tree's values. When expanding one of the tree's values, then the vertical scrollbar works as expected. I'd like to be able to set the tree's size initially so that it is fixed and the scrollbar is already shown when the WizardPage is first drawn, but doing this isn't particularly obvious to me - the setSize method on the TreeViewer's Tree doesn't seem to do anything.
Any help would be appreciated!
Just for the records for this old question:
We solve this problem in our applications by using an own layout manager which we can set fixed sizes for certain controls (with Swing we had done that by using component.setPreferredSize(size)). If no such fixed size is used, we calculate the preferred size of the control while performing the layout. This prevents making controls getting more and more space depending on the control's content when the user resizes the application window or dialog.