QSize MainMenuListView::Header::sizeHint() const
{
// fontmetrics() allows to get the default font size for the widget.
return QSize(menu->headerAreaWidth(), fontMetrics().height());
}
void MainMenuListView::Header::paintEvent(QPaintEvent* event)
{
// Catches the paint event ...
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
QWidget* w = new QWidget(this);
QHBoxLayout* hbox = new QHBoxLayout();
QVBoxLayout* vBox = new QVBoxLayout();
menuA = new MainMenuListView(w, "Images");
menuB = new MainMenuListView(w, "Video...
The QTimer::singleShot is used to call a slot/lambda asynchronously after n ms.
The basic syntax is :
QTimer::singleShot(myTime, myObject, SLOT(myMethodInMyObject()));
with myTime the time in ms, myObject the object which contain the method and myMethodInMyObject the slot to call
So for exampl...
You can include HTML comments in JSPs as well. You use the basic html comment syntax:
<!--Comment goes here-->
The difference between using JSP style comments and HTML style comments is the JSP ones will not be included when the HTML is generated and the HTML style comments will be. So it ...
Mailbox processors can be used to manage mutable state in a transparent and thread-safe way. Let's build a simple counter.
// Increment or decrement by one.
type CounterMessage =
| Increment
| Decrement
let createProcessor initialState =
MailboxProcessor<CounterMessage>.Sta...
You can use Scan or TryScan methods to look for specific messages in the queue and process them regardless of how many messages are before them. Both methods look at the messages in the queue in the order they arrived and will look for a specified message (up until optional timeout). In case there i...
The extra arguments add results to predicates of a DCG clause, by decorating the derivation tree. For example, it's possible to create a algebraic grammar that computes the value at the end.
Given a grammar that supports the operation addition:
% Extra arguments are passed between parenthesis afte...
Let's define a grammar enabling us to perform additions, multiplications with the usage of parenthesis. To add more value to this example, we are going to compute the result of the arithmetic expression. Summary of the grammar:
expression → times
expression → times '+' expression
times → elemen...
In general, MIDI protocol is broken down into "messages". There are 4 general classes of messages:
Channel Voice
Channel Mode
System Common
System Real-Time Messages
Messages start with a byte value above 0x80. Any value below 0x7F is considered data. Effectively meaning that 1...
Step 1 – Install LAMP
To start with Laravel, we first need to set up a running LAMP server. If you have already running LAMP stack skip this step else use followings commands to set up lamp on Ubuntu system.
Install PHP 5.6
$ sudo apt-get install python-software-properties
$ sudo add-apt-reposit...
Suppose we want to know how many users have the same name. Let us create table users as follows:
create table users(
id int primary key auto_increment,
name varchar(8),
count int,
unique key name(name)
);
Now, we just discovered a new user named Joe and would like to take hi...
Suppose we want to know how many users have the same name. Let us create table users as follows:
create table users(
id serial,
name varchar(8) unique,
count int
);
Now, we just discovered a new user named Joe and would like to take him into account. To achieve that, we need to d...
1. To write a simple data to test whether connection is working or not.
function myFunction(){
var firebaseUrl = "https://example-app.firebaseio.com/";
var secret = "secret-key";
var base = FirebaseApp.getDatabaseByUrl(firebaseUrl, secret);
base.setData("test&quo...