I was reading the GTK+ 3 reference about the function gtk_button_new_from_stock. There is this part:
gtk_button_new_from_stock has been deprecated since version 3.10 and
should not be used in newly-written code. Use
gtk_button_new_with_label() instead.
Then, I read the reference about gtk_button_new_with_label(), but there is no word about the possibility of creating a button from stock.
I've tried using
gtk_button_new_with_label("gtk-media-play");
but I only get a button with the label gtk-media-play.
Any way, when I use
gtk_button_new_from_stock("gtk-media-play");
I obtain what I want but I have also a lot of warnings about deprecation.
How do I use the suggested function gtk_button_new_with_label in order to obtain a button with stock image?
How can I solve this situation without using deprecated functions?
Stock items in general have been deprecated. You probably want new_from_icon_name() instead (I think the documentation should actually refer to that). There's a standard for icon names.
Related
I have a drop down menu "menu" for which I want to add a check item which should be checked by default.
How can I do the same in wxwidgets in C++?
check_option = menu->AppendCheckItem(CHECK_ID, wxT("Check"));
From the discussion,
In wxwidgets we don't have a one liner way to do the same. There is no other arguments that AppendCheckItem accepts. Hence we need to call the check function to do the same.
check_option->Check(true);
I'm making a QTableView based on a QStandardItemModel. I add data in the following fashion:
def addTableXYData(self,row):
label = 'Point '+str(row)
data = [label, self.x[row-1], self.y[row-1]]
for index, item in enumerate(data):
self.tableModel.setData(self.tableModel.index(row-1,index), item)
self.tableModel.layoutChanged.emit()
The strings for the label show up fine in the table, however it doesn't show the numbers. The numbers come from clicking points on a Matplotlib Qt Canvas, and are naturally numpy.float64 dtypes.
Is Qt5 capable of handling numpy.float64 datatypes? Or must I change it in to something else? I assume it may have something to do with PyQt5 using bindings to the C++ language, and maybe that can't handle it?
I've tried reading the docs on QVariant but it doesn't seem to tell me that I can't use floats.
Edit Instead of down-voting me without saying anything how about laying some wisdom on me and helping me out?
It turns out that PyQt5 does not possess the capability of sending numpy datatype classes to Qt5. It does native python classes like int(), float() etc. but not numpy.int32() etc. I assumed that would have been built-in functionality but, there ya go. The more you know.
I have just started using Qt creator. I have created a simple form in QT4 designer and I used python for it. It is a simple form with two fields and a button. These two fields populate values from the device that I have defined in my jive.I am using the following statement in python to read the values from the device:
taurus.Attribute('device_name/instance_name/attribute_name').getDisplayValue()
This statement fetches the value of the attribute and I am appending this value to the text fields I have on the form.I have an "import taurus" statement in my python code.I am trying to do the similar thing in C++ but I am not sure on how we can read the values from the device defined in jive. So could you let me know how this can be achieved.
This question is really framework-specific. There isn't many Tango users on StackOverflow. Have a look at the QTango documentation on QTWatcher and QTWriter.
Here is a basic example where the attribute value from your device is linked to a ProgressBar:
QProgressBar *pbar = new QProgressBar(this);
QTWatcher *pbarWatcher = new QTWatcher(this);
pbarWatcher->attach(pbar, SLOT(setValue(int)));
// configure maximum and minimum values when available
pbarWatcher->setAutoConfSlot(QTWatcher::Min, SLOT(setMinimum(int)));
pbarWatcher->setAutoConfSlot(QTWatcher::Max, SLOT(setMaximum(int)));
pbarWatcher->setSource("$1/short_scalar_ro");
Can give me someone an idea how I can switch of the antialiasing for all items in a goocanvasmm?
I tried to get the root item model but this did not contain the antialiasing property.
I could not really find any valid documentation for goocanvasmm. I really need a tutorial but I can't find some.
[edit]
Sorry, I need the code for goocanvasmm!!! not goocanvas. So please do not edit this again. Yes, it is the c++ version of gtk+ called gtkmm and the goocanvasmm
[edit]
I have now a rect in the canvas and I could get the rect->property_antialias()=???? but now i struggled with PropertyProxy.
the following both lines will not work:
1)
rect->property_antialias()=CAIRO_ANTIALIAS_NONE ;
no match for »operator=« (operand types are »Glib::PropertyProxy« and »_cairo_antialias«)
2)
rect->property_antialias()=ANTIALIAS_NONE ;
error: 'ANTIALIAS_NONE' was not declared in this scope
Thanks!
GooCanvaItemSimple is the base class for most items. It has an antialias property which is of a type that maps to cairo_antialias_t.
This is for the C version, not C++, but it should be easy to map to the 'mm' versions of the docs. Here's the equivalent for antialias in goocanvasmm.
When you don't know where a property is, just dig in the parent classes or interfaces implemented until you find it.
Then, set the value of the appropriate Cairo::Antialias type (which is a type defined in cairomm).
rect->property_antialias() = Cairo::ANTIALIAS_NONE;
I'm trying to use the khtml library, basically just the DOM html implementation from there, but I even failed to create a basic HTMLDocument from a file using load(), and when I tried to create a HTMLDOcument by mutating it via appendChild I get DOMException with errorcode == 8 (NOT FOUND).
Can anyone please point me to some sample code which uses khtml's dom model without obtaining the document from the GUI components?
Ok, I see what the problem was.
First, if you're using a local html file, your uri needs to be absolute when you call DOM::HTMLDocumemt::load(const DOM::DOMString&).
Secondly, you need to create a DOM document, but it's read-only by default after creation.
So, before you actually call load(), you need to make it editable via
DOM::Document::setDesignMode(bool designOn).
That fixes it.
If I may recommend, WebKit is far superior to khtml now, even konqueror will be using webkit by default next release.
Check QtWebkit.