enum ReadResult{
case Successful
case Failed
case Pending
}
struct OutpuData {
var data = Data()
var result: ReadResult
var error: Error?
}
func readData(from url: String, completion: @escaping (OutpuData) -> Void) {
var _data = OutpuData(data: Data(), ...
This shows you how to use Microsoft.Extensions.DependencyInjection nuget package without the use of the WebHostBuilder from kestrel (e.g. when you want to build something else then a webApp):
internal class Program
{
public static void Main(string[] args)
{
var services = new Se...
IServiceCollection
To start building an IOC container with Microsoft's DI nuget package you start with creating an IServiceCollection. You can use the already provided Collection: ServiceCollection:
var services = new ServiceCollection();
This IServiceCollection is nothing more than an implemen...
First of all you'll need to have a key pair. If you don't have one yet, take a look at the 'Generate public and private key topic'.
Your key pair is composed by a private key (id_rsa) and a public key (id_rsa.pub). All you need to do is to copy the public key to the remote host and add its contents...
The vertical layout set up the object inside it vertically.
#include "mainwindow.h"
#include <QApplication>
#include <QMainWindow>
#include <QWidget>
#include <QVBoxLayout>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication...
/*!
* \class MainMenuListView
* \brief The MainMenuListView class is a QListView with a header displayed
* on top.
*/
class MainMenuListView : public QListView
{
Q_OBJECT
/*!
* \class Header
* \brief The header class is a nested class used to display the hea...
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...
Here is a sample output:
As you can seen above, it can be useful for creating stacked menus.
Note that this sample is trivial. The two widgets have the same size constraints.
You can combine mulple layout thanks to other QWidgets in your main layout to do more specifics effects like an information field: for example:
#include <QApplication>
#include <QMainWindow>
#include <QWidget>
#include <QVBoxLayout>
#include <QPushButton>
#inclu...
This is an example of how you would do a one to many mapping using XML. We will use Author and Book as our example and assume an author may have written many books, but each book will only have one author.
Author class:
public class Author {
private int id;
private String firstName;
...
To access the Open Resource dialog use Ctrl + Shift + R.
From here you can start typing a resource name and it will find all matches in the workspace, this makes it easier to find a file when you don't know exactly were it is.