File Chooser settings are automatically overwritten on RHEL8 - directory

I have RHEL8 with GNOME desktop.
I am trying to make the file chooser to show hidden files and directories.
I discovered gsettings and dconf-editor tools.
Through either of them I can get to org.gtk.Settings.FileChooser and request eaither of them to show and/or set the value of the "show-hidden" property.
By default show-hidden is false.
$ gsettings get org.gtk.Settings.FileChooser show-hidden false
Same with the dconf-editor. I can change the value to true. It stays true for some time but when I try to open FileChooser I do not see hidden files or directories. And after I close FileChooser the value is overwritten back to "false".
Is it a bug or there is somethign preventign changes to the desktop configuration?
I tried setting the value through dconf-editor or gsettings.
I was expecting the value to stay permanently changed and the FileChooser to respect it and show hidden files and directories.

Related

Qt widget promotion error after reconstruct the folder of code

Class DCGraphicsView is a subclass of QGraphicsView, I put a QGraphicsView Widget on the UI file framework.ui. And the I promote that QGraphicsView Widget to DCGraphicsView. After clean, qmake and rebuild, everything is OK as expected.
But after I moved those code and ui file into a subfolder named ui, and modify the pro as well, use the same procedure as previous (clean, qmake and rebuild). An error message displayed when doing rebuild.
To figure out what causes this error, I cancel the promotion of QGraphicsView Widget, then no error pops out. If I put it back, the same error comes again. Confused.
error message as follows:
No rule to make target 'dcgraphicsview.h', needed by 'ui_framework.h'.Stop.
The "Header File" field in the promote dialog should contain the path of the header file relative to the base directory from which uic, Qt User Interface Compiler, is executed, so it should be "ui/dcgraphicsview.h".
You can change the path by double clicking on the path in the "Promoted Widgets" dialog.
I got the right solution. In pro file, use UI_DIR to specify the location of ui files. In unix like system, use unix:UI_DIR; and win32:UI_DIR for windows.

QFileDialog : how to set option to show content of folder in getExistingDirectory()

I am using QFileDialog as
filename = QFileDialog::getExistingDirectory(this,"Select Image File: ",dataDir,0);
I want that I can check files inside folder before selecting it. function getExistingDirectory() is setting QFileDialog::ShowDirsOnly as a default option. I checked in docs there is no any option that do opposite of this. So I set last parameter 0. But now it is not using native dialog. I want to use native dialog with this. I have no clue how to do this cause no flag found in options for UseNativeDialog. Please help.
Try creating the file dialog on your own, something like:
QFileDialog dialog(this);
dialog.setFileMode(QFileDialog::Directory);
dialog.setViewMode(QFileDialog::Detail);
dialog.setDirectory(datadir);
dialog.exec();
The code by Sebastian should create a native dialog, unless you make a line such as:
dialog.setOption(QFileDialog::DontUseNativeDialog, true);
However, I have not been able to get this working under Windows, even though the documentation says that the QFileDialog::Directory option should display files by default. Not only that, but doing:
qDebug() << dir_selector.testOption(QFileDialog::ShowDirsOnly);
displays false on my system, indicating that there is probably a bug somewhere.

read-only cells in ipython/jupyter notebook

Is there a way to mark a cell in the ipython/jupyter notebook readonly using the json format in the ipynb file? (E.g., a cell attribute "readonly":false or some such.) If not, is there a jquery hack to find suppress the double click event in the cell?
#Richard Ackon's answer requires adjustments for JupyterLab:
Open the Property Inspector.
Focus the cell you want to lock.
Add the following lines to the Cell Metadata:
{
"trusted": true,
"editable": false,
"deletable": false
}
Click on the tick to save the metadata... Tadah!, your cell can't be modified or deleted.
The Property Inspector comes built-in since JupyterLab 2.0 (note it was moved to the right sidebar by default in JupyterLab 3.0). For older JupyterLab versions you would need to modify the notebook file manually.
Unfortunately, the outputs can still be cleared by intentionally selecting that option in the menu bar (Edit > Clear Ouputs). Of course that can only happen if you DO WANT to clear the outputs and not just update them by running the cell.
Source
Yes, Use the steps below:
Select view on the menubar
Point to Cell Toolbar and select Edit Metadata
An "Edit Metadata" button will appear at the top-right corner of the cell.
Click on that button and edit the json that pops up. Set the editable key to true or false to get the desired effect.
The JSON will look something like this:
{
"deletable": false,
"editable": false,
"scrolled": true,
"trusted": true
}
There is an extension for IPython that is supposed to that:
Read Only Cell extension.
Getting it to work is something else, but it is there.

QRadioButton check/uncheck issue in Qt

I am finding issues related to check/uncheck of QRadioButton. The images I have used for checking(a white dot) and unchecking(without a white dot) is not updated.
My issue is like: I have implemented few QRadioButton(s). For the first time all the QRadioButtons checked false. So the images for this case is without a white dot. When user selects any QRadioButton then it's image changes to another i.e. image with a white dot. On a button click I am resetting the state of the radio buttons from checked to uncheck state . However the images state are not changing. They remain in checked state. The code snippet is as follows:
Code:
if(ui->radioButtonReadOnlineData->isChecked())
ui->radioButtonReadOnlineData->setChecked(false);
if(ui->radioButtonSavetoDBReadOfflineData->isChecked())
ui->radioButtonSavetoDBReadOfflineData->setChecked(false);
if(ui->radioButtonViewLocalData->isChecked())
ui->radioButtonViewLocalData->setChecked(false);
if(ui->radioButtonDateRange->isChecked())
ui->radioButtonDateRange->setChecked(false);
if(ui->radioButtonAll->isChecked())
ui->radioButtonAll->setChecked(false);
The images for each of the QRadioButtons is set as like:
Code:
ui->radioButtonAll->setStyleSheet(
"QRadioButton::indicator::checked { image: url(:/Resources/radio-btn-selected.png);}"
"QRadioButton::indicator::unchecked {image: url(:/Resources/radio-btn-unselected.png);}"
);
Any clues why the QRradioButton images are not updated. Thanks.
Your problem is most probably related to
setAutoExclusive(bool)
By default all buttons belonging to the same parent behave as if they were part of the same exclusive button group. After having selected one you are not able to return to having all buttons unchecked.
A work around is to find out what button is checked, and for that button do the following
theSelectedButton->setAutoExclusive(false);
thsSelectedButton->setChecked(false);
theSelectedButton->setAutoExclusive(true);
Take a look at these links for more information:
http://developer.qt.nokia.com/forums/viewthread/5482
http://www.qtforum.org/article/19619/qradiobutton-setchecked-bug.html
Make sure your resource file look like :
<qresource>
<file>Resources/radio-btn-selected.png</file>
<file>Resources/radio-btn-unselected.png</file>
</qresource>
And that it is included correctly in your application.
Either include the .qrc in your .pro file with
RESOURCES = myresource.qrc
either create an external binary resource file, then register it at runtime with
QResource::registerResource("/path/to/myresource.rcc");
Or if you are using the designer, you can do like this.

openning files in another browser page/tab

i have an action that return a file content. i added:
Response.AddHeader("Content-Disposition", "attactment; filename:\"" + survey.File + "\"");
so that the image would be opened in another tab/page, gets opened in the current tab/page.
whats wrong with the header?
The content-disposition header instructs the user agent how it should present the data, and it is usually used when serving up binary data (as opposed to plain text). When set to "attachment", the display of the content is contingent upon further action of the user. In other words, the user should receive a prompt and must decide what to do with the content (usually given an "Open" or "Save" option).
You can not programmatically force a hyperlink to open up in a new tab. Even if you could, you should not. This behavior should be controlled by the user agent. As a user, when I want to open something in a new tab, I use the mouse-wheel-click because that is how my browser is configured.
You cannot control browser's tab behaviour by using HTTP headers - there is nothing in your code that affects this.
What might help you is changing HTML code that points to your download - if you are using tag you can set its target attribute to _tab or _blank and it will work in many browsers.

Resources