I've a question considering the current setup:
Yocto Linux on iMX6
Neither a window-, nor a display-manager
A fully functional Qt Application, tested on Debian 9
The application consists of 2 main elements:
A GStreamer part, with a imxg2dvideosink
A semi-transparent Qt Overlay, which should be displayed over the stream
The question:
How can I accomplish to display the overlay over the stream, while having both parts on fullscreen (filling the whole screen)? Possible solutions:
/dev/fb1 as an overlay to /dev/fb0 (How to split a single application to two fb's ?)
Use a display-manager ?
Use a window-manager ?
linuxfb instead of eglfs ?
My current (not working) solution:
Using -platform eglfs
The application will first start GStreamer, and afterwards show the overlay
I've found the solution myself. Shared below:
1) Run Qt Application on /dev/fb1:
export QT_QPA_EGLFS_FB=/dev/fb1 (Specify /dev/fb1 as eglfs framebuffer)
echo 0 > /sys/class/graphics/fb1/blank (Unblank framebuffer)
fbset -fb /dev/fb1 --geometry <your geometry here> (Set framebuffer geometry)
./YourApplication -platform eglfs (Run application)
Use a Color Key if you want full opacity while having fully transparent parts of your overlay.
2) Run GStreamer on /dev/fb0:
gst-launch-1.0 videotestsrc ! imxg2dvideosink framebuffer=/dev/fb0
This is the solution for eglfs. Other possibilities are linuxfb.
Related
I want to format my Qt code via a shortcut in Qt Creator, just like ctrl + shift + F in Eclipse.
But didn't found one in Qt creator options, nor after searching via google.
So, do there has such a shortcut in Qt Creator? If no, then how to format code?
You can at least indent your code in the following way. First, select the portion of code you want to indent (or Ctrl + A, if you want to indent all source code in the current file) and then Ctrl + i.
If you're on a Mac OS X, use Command instead of Ctrl.
First, install clang-format.
If you're on Ubuntu, you can do it with sudo apt-get install clang-format.
Then go to Help -> About plugins, and check Beautifier.
Then restart Qt creator.
Now, go to Tools -> Options -> Environment -> Keyboard and find where it says "Format Current File" in the middle column, then click on it.
And at the bottom of this window click on record, and record the key sequence that you would like to use to format the current file.
RStudio is great IDE for R development. I wonder if there is any way for nice support HiDPI resolution?
I currently have 13 inch display and 3200x1800 resolution, it is even hard to read RStudio options to adjust more appropriate setting.
This is of course not an RStudio issue but general issue related to high resolution display which requires HiDPI support to make it reasonably usable.
Posting it here as question because RStudio still doesn't allow to fill questions/issues on github.
RStudio is a Qt application. I've solved this by setting a scaling factor in Qt with this environment variable (note it must be an integer):
export QT_DEVICE_PIXEL_RATIO=2
The Arch wiki has some excellent advice on getting HiDPI working.
UPDATE: This solution is only for WINDOWS!
There is a simple solution for you, it comes from the option "Compatibility" of the execute file.
Close all current RStudio windows.
Right click on the shortcut of RStudio (or the original exe file) and choose Properties
In the RStudio Properties pop-up windows, choose the tab Compatibility
Tick on option Override hide DPI scaling... and then choose System from the drop-down list.
Apply > OK.
(Re)open Rstudio to see the change
Note that, on the HiDPI screen, resolution of modified RStudio is not so good but it really solved the bad scale problem.
You can also apply this technique to other apps without supporting HiDPI.
I use the following bash script to determine the current screen resolution and substitute the scaling factor by 1 (normal resolution) or 1.75 (high resolution) in the RStudio desktop file:
#!/bin/bash
# Determine resolution
width=$(xdpyinfo | grep 'dimensions:' | grep -o -E '[0-9]+' | head -1 | sed -e 's/^0\+//')
echo "Screen width is $width pixels"
if [ $width -gt 3000 ]; then
echo "High resolution detected -> setting zoom level to 1.75"
sed -i 's/view.zoomLevel.*/view.zoomLevel=1.75/' ~/.config/RStudio/desktop.ini
else
echo "Normal resolution detected -> setting zoom level to 1.0"
sed -i 's/view.zoomLevel.*/view.zoomLevel=1/' ~/.config/RStudio/desktop.ini
fi
QT_QPA_PLATFORMTHEME=gtk2 /usr/lib/rstudio/bin/rstudio %F
I am on Ubuntu 17.10. If I want to use the GTK theme, I have to set the QT_QPA_PLATFORMTHEME environment variable.
I am using yocto, and already have a build of qt5 in my image and it works. The issue is that it is HUGE.
So, I tried to use a .bbappend recipe in my layer for qt where I experimented with using
PACKAGECONFIG_remove = " qtnetworking qtdeclarative sql-mysql qtscript...etc";
and
EXTRA_OECONF = " -no-accessibility -no-feature-MDIAREA -no-feature-DRAGANDDROP ...etc";
I even removed all the feature disablement config params in EXTRA_OECONF and just added -qconfig minimal or -qconfig medium.
====> the result is always the same: compilation failure in the qt corelib or qtwidgets.
I want to disable networking, printing, and mdi support. How can I do that?
Much appreciated!
I have a Friendly-ARM embedded board with a W35 3.5" Touchscreen. You can see the board via the following link: http://www.friendlyarm.net/sites/products/mini2440-35s.jpg. Also I write QT program for that using Qt Creator. I have to write a GUI using QT with Width x Height = 240 x 320. I mean width = 240 and height = 320. According to what I found at various online documents and pages, the dimensions of W35 are 320 x 240, it means width = 320 and height = 320. So when I run the program, there are large margins at left and right and some part of GUI is cut at top and button. How do I exchange the board width and height?
The closest page I found on Friendly-ARM site is: http://www.friendlyarm.net/forum/topic/2881.
At this page someone mentioned, there is a file s3c2410.c at drivers/video directory, or there is file mach-mini2440.c at arch/arm/mach-s3c2440 directory and we should tweak some C #define, but I don't have neither one on the board kernel. What should I do?
1) Reinstalling the Kernel?
2) Writing program for 320 x 240 instead of 240 x 320
3) Changing the touchscreen to similar ones like X35 or T35
FYI, when the board starts up, there is Qtopia with right dimensions.
TIA,
-- Saeed Amrollahi Boyouki
First of all cross-compile your Qt with -qt-gfx-transformed option.
Method 1:
You can rotate your Qt Application using
./myApp -qws -display ":Transformed:Rot90:0"
Method 2:
You can set Display Dimension using
export QWS_DISPLAY=Transformed:Rot90:0
and start your application using
./myApp -qws
What you need to look for are instructions to rotate the display from "landscape" mode to "portrait" mode. I am unsure if there is a hardware option on the ARM processor included in the FriendlyArm, but that gives you a place to start searching. I'd also look in the Qtopia forums for a similar switch, ie http://qt-project.org/forums/viewthread/8875 or similar.
Bug in Qt5.2.1:
The only problem was corrected in QPrintPreviewDialog but when the print is printed on paper the failure still exists.
With QPrintPreviewDialog pages work perfect, but on "paper" (printed in paper) from second page (in other words all pages except the first occur the BUG) "texts" and "images" (non-background) disappear (apparently the fault only occurs with inline elements).
See:
https://bugreports.qt.io/browse/QTBUG-37240 (see the attachments to a test-case)
Bug in Qt5.0.1, Qt5.0.2 and Qt5.1.0
The first page of the print out of a QWebView with small fonts and images.
Apparently the problem only occurs with inline elements (texts and images).
Note: The error occurs in Windows XP, Windows 7, Window 7 x64, Mac OS X 10.8.3
[edit]
Source-html: http://jsfiddle.net/bdm6Y/2/
Frame content: http://jsfiddle.net/bdm6Y/2/show/
Source:
QPrinter p;
p.setPaperSize(QPrinter::A4);
p.setFullPage(true);
p.setResolution(300);
p.setOrientation(QPrinter::Portrait);
QPrintPreviewDialog preview(&p);
preview.setWindowTitle(ui->myWebView->page()->mainFrame()->title());
connect(&preview, SIGNAL(paintRequested(QPrinter*)), this, SLOT(printPreview(QPrinter*)));
preview.exec();
...
void printPreview(QPrinter *printer) {
ui->myWebView->print(printer);
}
I do not know if this is a bug or something I did wrong, what could it be?
Thanks!
[edit]
QT bug reports:
https://bugreports.qt.io/browse/QTBUG-30621
Problem fixed in Qt5.3
Qt 5.3 Print Support
New QPA class QPlatformPrintDevice to abstract platform print device hardware, new implementations for Windows, Mac and Linux.
QPrinterInfo provides more details on the print device hardware
QPrinter uses QPageSize and QPageLayout to improve page layout handling
QPrinter has had the behaviour of most functions standardised across all platforms (as detailed below)
Mac can now have each painted page with a different orientation, and can set Collate Copies and Document Name.
Mac and Windows now support setting Document Creator and Duplex Mode
Mac and Linux now support using Windows Page ID (DMPAPER values)
Linux now requires CUPS 1.4 (RHEL 5 no longer supported)
Code tested in Windows:
QPrinter print(QPrinter::HighResolution);
print.setPageMargins(qreal(1), qreal(1), qreal(1), qreal(1), QPrinter::Millimeter);
print.setPaperSize(QPagedPaintDevice::A4);
QPrintPreviewDialog pd(&print, mwindow, Qt::Window);
QObject::connect(&pd, SIGNAL(paintRequested(QPrinter *)), this, SLOT(preview(QPrinter *)));
if(pd.exec() == QPrintPreviewDialog::Accepted) {
/*something*/
}
...
void MainWindow::preview(QPrinter* p) {
mframe->print(p);//mframe is an QWebFrame
}