If you derive your class directly from QWidget object and want to apply some stylesheet tags for customize interface you'll find that your stylesheet settings will not work. Just only a simply stylesheet tag for set background color as follow will not have any effect:

myDerivedWidget.setStyleSheet("background-color: red;");

This because basic QWidget object doesn't automatically manage stylesheet tags. Fortunately add this feature is very easy. What you need to do is to overwrite paint event in your derived class and add the following code:

void myDerivedClass::paintEvent(QPaintEvent* event)
{
    QPainter painter(this);
    QStyleOption StyleOpt;

    StyleOpt.initFrom(this);
    style()->drawPrimitive(QStyle::PE_Widget, &StyleOpt, &painter, this);
}

This will allow the first example stylesheet tag to work as expected.


The 'linusb' is one of the most used open source library for work with usb devices. It allow to make the basic usb data transfers operation in a little bit easier way compared to standard system calls. Here a short tutorial regarding how to use asynchronous bulk transfer.


Is possible to easily set the background color of a widget by changing the palette of widget itself. The code is very easy as follow:


MyWidget->setAutoFillBackground(true);

// We set a white background color for this example
QPalette FramePalette(MyWidget->palette());
FramePalette.setColor(QPalette::Background, Qt::white);
MyWidget->setPalette(FramePalette);

Please note that for have our custom backgound color showed is need to set the setAutoFillBackground flag to true as the example.
QTableWidget is the Qt widget that, as the name suggest, show a table composed by cells able to contain both native field like text or icon and also more complex widgets like listbox, checkbox and so on. Usually for Qt list widgets the method clear() remove all the rows currently showed in the control. However, also if present, this call doesn't work for QTableWidget control. If you want to remove all the rows from QTableWidget you need to simply set the number of rows to zero as follow:

MyTable->setRowCount(0);

This will have same effect of clear() and remove all rows.

In case your Android project consist in a lot of source files you should, normally, add one by one to the LOCAL_SRC_FILES label and this could be a very boring task to complete. Fortunately there is the possibility to make addition of multiple files using wildcards in a very easy way. Let's go to see how to make it.