What does this Zurb Foundation 6 mixin #include xy-grid() mean? - zurb-foundation

What does this Zurb Foundation 6 mixin mean
#include xy-grid();
Which one does it define, grid-x or grid-y?

#include xy-grid;
This only does display: flex.
You can also use the mixin with arguments to make it vertical (grid-y):
#include xy-grid($direction: vertical, $wrap: false);
API docs: https://foundation.zurb.com/sites/docs/xy-grid.html#xy-grid

Related

QT- Signal and Slot setEnabled(bool) slot not working

I have been working on a simple notepad application using QT, and am currently stuck at a place where I have to disable the actionUndo and actionRedo when undo or redo are not applicable respectively. I used the connect method of QT, and currently my constructor function (along with includes) looks like this:
#include "notepad.h"
#include "ui_notepad.h"
#include "about.h"
#include <QFile>
#include <QTextStream>
#include <QFileDialog>
#include <QIcon>
#include <QFont>
#include <QFontDialog>
#include <QTextCursor>
Notepad::Notepad(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Notepad)
{
ui->setupUi(this);
setWindowTitle("QNotepad");
setWindowIcon(QIcon(":/icons/icons/qnotepad.png"));
setCentralWidget(ui->textBody);
//Enabling the options, only when applicable
connect(ui->textBody, SIGNAL(undoAvailable(bool)), ui->actionUndo, SLOT(setEnabled(bool)));
connect(ui->textBody, SIGNAL(redoAvailable(bool)), ui->actionRedo, SLOT(setEnabled(bool)));
}
Full sources are here
But seems it is not working as when I run the program, the actionUndo and actionRedo remains enabled even when there is no undo and redo operations available.
I am using Arch Linux as the primary development environment
Qt Ui elements (widgets, actions, etc.) are enabled by default, so you need to uncheck the enabled flag for the Undo and Redo action in the property window of Qt designer for your notepad.ui file.
Alternatively you could do it in the constructor of your window like this:
ui->actionUndo->setEnabled(false);
ui->actionRedo->setEnabled(false);
//Enabling the options, only when applicable
connect(ui->textBody, &QTextEdit::undoAvailable, ui->actionUndo, &QAction::setEnabled);
connect(ui->textBody, &QTextEdit::undoAvailable, ui->actionRedo, &QAction::setEnabled);
In this way they will be on/off only when the QTextEdit emits the signal.
Also consider to use the functor syntax for your signal/slot connection, as shown in my code snipped, because it has several advantages. See here to learn more.

Vlc-qt subtitles

How to switch on/off subtitles in vlc-qt media player? By default subtitles switched on.
I use this stuff:
#include <VLCQtCore/Common.h>
#include <VLCQtCore/Instance.h>
#include <VLCQtCore/Media.h>
#include <VLCQtCore/MediaPlayer.h>
#include <VLCQtCore/Audio.h>
On your vlcMediaPlayer (i'll call it media since you didn't show any code) object try
media.video()->setSubtitle(-1);
VlcMediaPlayer has a video object which is the one calling the video functions in which the setSubtitle one resides. See this vlc-qt/Video.h

Load OpenGL function pointers using glad withing a QOpenGLWidget

So I am reading up on some OpenGL and I want to use the QOpenGLWidget for drawing to maybe create some other helpful UI elements later. I am using glad for resolving the function pointers to OpenGL but I have no idea how to use Qt's getProcAddress function!
Inside my QOpenGLWidget subclass' initializeGL() function I have tried:
if(gladLoadGLloader((GLADloadproc) currentContext()->getProcAddress) {}
but that did not work out since Qt's function is overloaded. When I use
if(gladLoadGL()) {}
it doesn't work either. My includes are:
#include <glad\glad.h>
#include "OpenGLViewport.h"
#include <QDebug>
#include <QOpenGLContext>
I have searched Mr. Google and I've had a diligent look through the Qt documentation and found nothing. I want to use GLAD just so my rendering code is not bound to Qt too tightly, in case I want to switch later.
EDIT: I am aiming to use the noninstanced OpenGL functions with Qt (though the documentation recommends otherwise if I recall correctly). Because then I'd be able to seemlessly switch to GLFW for providing a window etc.
Moved solution from question to answer:
ANSWER: So it turns out I just had some things mixed up, this is how I got it to work, in case anyone has the same problem:
add glad.c in your project
add the necessary headers to your include directory
the .cpp file of your QOpenGLWidget subclass should have following components:
// Subclass.cpp
#include <glad/glad.h>
// important, subclass header file after glad!!
// otherwise glad won't "hook"
#include "Subclass.h"
void Subclass::initializeGL()
{
if(gladLoadGL()) initialized = true; // initialized is a class member here
else; // handle errors
}
void Subclass::paintGL()
{
if(initialized); // render here
}

Replacing widget with custom template widget in Qt Creator Designer

In Qt Creator UI Designer it is possible to replace a widget with its subclass. I have created a template subclass of QComboBox:
template <typename T>
class MappedComboBox : public QComboBox
{
// ...
};
And I have successfully managed to replace QComboBox with MappedComboBox<int>. However replacing QComboBox widget with, for instance, MappedComboBox<QSerialPort::BaudRate> fails due to dependency errors while building like
'QSerialPort' was not declared in this scope.
Of course one way to get rid of them is to include QSerialPort in mappedcombobox.h however that's not a very elegant way. Can I somehow tell Qt Designer to include additional files while generating UI?
In the UI designer there is no way to include an extra header. A better workaround is to include it in the cpp file of the designer class before including the generated header. That's better than including in the MappedComboBox which has no business with that header.
In mainwindow.cpp:
#include "mainwindow.h"
#include <QSerialPort>
#include "ui_mainwindow.h"

Qt custom look and feel?

can I force my Qt application to use different look and feel just like it is done in KDE ?
You can always change styles of widgets using QApplication::setStyle.
There are a few predefined options available in Qt4.
In main.cpp do something like this
#include <QPlastiqueStyle>
int main(int argc, char *argv[])
{
[...]
QApplication::setStyle(new QPlastiqueStyle());
}
This way your application will alwyas look the same on different OS.
In my opinion Plastique looks better under windowsXP/2000 then default QWindowsXPStyle.
Cleanlooks is quite nice too.
There are other options:
#include <QPlastiqueStyle>
#include <QCleanlooksStyle>
#include <QWindowsXPStyle>
#include <QWindowsVistaStyle>
#include <QMotifStyle>
#include <QCDEStyle>
I hope this helps.
You can use CSS to style widgets https://doc.qt.io/qt-5/stylesheet.html