What class does Qt designer use to edit the properties of UI elements? - qt5

At the moment I'm writing a tool to extract parts of frames of mp4-video files. You draw rectangles on the video and the tool extracts .png-images at regular intervals. Now I want to give the user the ability to edit the properties of individual rectangles they have drawn on the video (exact position, frequency of frame extraction, time frame, etc.). I like the approach that QtDesigner takes for editing ui elements. You can see what I mean in this screenshot i found on the internet
The yellow and green table contains name value pairs for the different properties of the selected ui element. The table is devided into section depending on what class the property was inherented from. In the Screenshot the green part is inherented from MarbleWidget. The yellow part is inherented form a different class. I want each division to refer to a different rectangle and the color to match the colour the rectangle is drawn in on the screen.
I've tried using QTreeView, QTableView, QToolBox and QTableWidget but none of these - to my knowledge - offer putting QWidgets in the "value" part of the table. In the screenshot you can see tick boxes for example. In my case I would want to use a range slider. Does anyone know what class is used to Implement this table?

I think you'll find it difficult to use the designer classes in a normal application.
See qtpropertybrowser for a properties editor.
See setIndexWidget for a static widget. As it says, use QItemDelegate for dynamic widgets. Note that the specific item subclasses have their own methods like QTableWidget.setCellWidget.

Related

Displaying Multiple Images using labelProvider

We have been working in a Tree Editor. We are displaying icons below the file names. Now, we have a need to display another icons below this already displayed icon. This icon will be displayed based on some parameters. Hence, it is not necessary that always multiple icons will be displayed.
We have our own LabelProvider which correctly returns a single image.
Please, let me know how can I customise my LabelProvider to return multiple images ?
The normal LabelProvider only supports returning a single image per row.
There are some classes available which let you make a composite image from several separate images. The abstract base class for these is CompositeImageDescriptor. The DecorationOverlayIcon class is a concrete class based in this which supports a main image with up to four overlay images (this is what views like Package Explorer use).
If those classes are not enough you can use a label provider based on OwnerDrawLabelProvider - which allows you to draw what you like in the row.
Note: All rows in a tree (or table) are always the same height. A deep image in one row will force all the other rows to be the same depth.

Which Cocoa UI element(s) should I use to display table like information - Mac OS X?

I want to display information of a person, it would look like:
Name: Tom
Address: Long address, multi line,
next line, Long address
Comment: some text
Please notice that each property may be multi-line text. The UI widget should auto resize height to fit the content, if new information is loaded.
In a web app, I know it can be done by layout with table. But how can I do this in a Cocoa Mac OS X app?
----- edit -----
To make this question more precise, assume this use case:
I have a view(widget, control) that display text.
The text is dynamically set.
The view's width must be(or is set to be) fixed.
The view's height automatically adjusted depending on the text, text may be wrapped into several lines.
My question is, is there a cocoa view to do this? I don't want to calculate and set the height programatically .
You'd be looking for NSTableView if it's to be the same information for many (or more than 1) persons. Details can be found here: About Table Views in OS X Applications.
(some nice sample code on Apple's site as well, just follow the links in the class reference)
Or if you're just displaying information for 1 person you could use a bunch of NSTextField s (the read-only flavour is called Label in Interface Builder).
An NSTableView would probably suit best, but it depends on how you want your UI to look and feel.

live tiles in Windows Phone and Grids

I'm trying to create a live tile for my application, using a user control.
The user control contains a grid, an image and a rectangle filled with color.
Now here comes the funny part.
I want the rectangle to act as a background for the tile's title, and the image to fill the rest of the tile. And i said to myself, well, lets put some rows in that grid and set the like you usually set them in a WPF/SL application.
I then write the entire thing in a WBM and save it to isostore.
The problem is, the parser seems to ignore the presence of grid's rows. regardless of what I try, the rectangle is not shown, and the image covers the full tile, when it should only cover the first row. It is as if the grid didn't even existed.
Another funny aspect is that it doesn't matter if I use rows or columns, the result is the same.
Any ideas?
Are you using the following method?
Dynamic LiveTile - adding background image?
I recently implemented a Live Tile using a Grid with Rows and Columns for layout of some TextBlocks. I encountered similar challenges, so I placed the control that I was using for my Live Tile on a blank page in my app to better see what was happening. Does the control render correctly when displayed on a page (versus being rendered to a WriteableBitmap)?
Another idea. Instead of trying to position the Rectangle relative to the tile's Title, why not leave the Title property blank and put the same text in a TextBlock within the user control?
If you are careful about the font and positioning of the TextBlock, the text on the resulting background image can appear indistinguishable from text displayed from the Title property. I decided to follow this strategy myself. I found the font information in the following answer:
Font size and family for a tile's title
Otherwise, could you post an example of the XAML you are using?

What type of annotation (or other object) to use?

I'd like to take an existing PDF and add semi-transparent rectangles on top of the pages, at pre-defined locations. When the user moves the mouse over the rectangle, it should change color and/or transparency. I should be able to define different colors (including transparency) for both states. Clicking on it executes some action that I define (such as going to another page, or a website).
I understand that this can be done with annotations, but I'm having trouble figuring out which type of annotation would be best suited. They also don't seem to handle transparency very well. Of course, I'm open to using something other than annotations, if need be...
1) That would have to be annotations. If it's clickable-and-does-something, it's an annotation. It could be an annotation on top of some page content, but an annotation must be involved.
2) You can set the appearance of a button to be arbitrary PDF content, including "normal" and "mouse-over" appearances. Note that these appearances aren't available through the Acrobat UI, but can be accessed programmatically from your API of choice at the object level. All appearance dictionaries have 3 different states: "N"ormal, "R"ollover, and "D"own.
To be honest, I've never tried setting a form field's rollover (or down for that matter) appearance, so I'm not sure how well that will work, but the Theory is sound.
What's the difference between theory and practice? In theory, there's no difference between theory and practice. Ouch.
You didn't specify a programming language/os/anything, so it's not possible to give more detail.
Use a button with an ICON appearance and a transparent background. The icon is an arbitrary PDF content stream with resources. Within it, you can set transparency just like you would as part of a page content stream. In fact, the only way the acrobat gui lets you pick an icon is to select a page from an existing PDF document.
Alternatively you might also be able to set the widget's /DA to use transparency with an extended graphic state resource that you'd add to the Acroform's DR dictionary. I haven't tried that myself.

Draw Lines on gtk.TextView

I'm trying to show the "selection" of a certain sub-string in a
gtk.TextView by drawing a border around the word. The only way to mark
text in a TextView that I've found so far is by placing TextTags with
modified properties. This does not seem to offer a way to draw a border,
though, DOES GTK SUPPORT THIS OR IS THIS A PROBLEM WITH ONLT PYGTK
I figured out how to draw on a text view !!!
To begin with lets assume the reference to your gtk.TextView is in a variable called viewer, Inside one of ur classes
Also the draw function has to be called with an event called expose-event else the drawings will be refreshed and will not stay on the screen
The next part is the gtk.TextView consists of 7 types of gtk.gdk.windows on which u can draw
gtk.TEXT_WINDOW_WIDGET
gtk.TEXT_WINDOW_TEXT
gtk.TEXT_WINDOW_LEFT - not displayed by default
gtk.TEXT_WINDOW_RIGHT - not displayed by default
gtk.TEXT_WINDOW_TOP - not displayed by default
gtk.TEXT_WINDOW_BOTTOM
gtk.TEXT_WINDOW_PRIVATE
For the drawing to appear on gtk.TextView We have to draw on gtk.TEXT_WINDOW_TEXT
An Example Code is as shown Below
if(viewer!=None):
viewer.connect("expose-event", expose_view)
self.drawable=viewer.get_window(gtk.TEXT_WINDOW_TEXT)
def expose_view(self,window,event):
if(self.drawable!=None):
self.drawable.draw_line(self.drawable.new_gc(),1,1,30,30)
# (1,1) and (30,30) are the coordinates and u can give the values accordingly
In a gtk.TextBuffer tags are used to set one or more pre-defined text attributes. Without subclassing, this is limited to the properties of a gtk.TextTag, and doesn't include anything akin to a border or outline property. There is no difference between PyGTK and plain GTK+ in this regard.
While somewhat hacky, the easiest way to do what you want to do is to connect to the expose-event of your gtk.TextView, get the coordinates of your string and draw on event.window, which is the gdk.Window of the event provided in the expose callback.
(Note that you don't have to get and store the gtk.TEXT_WINDOW_TEXT window, you just need to check what window the expose event is for in the callback, probably ignoring the expose if it's not for the text window.)
Instead, you could presumably subclass one or more of TextBuffer/TextView/TextTag to add a border tag, but whether it's reasonable to do so is another question.