66012 Commits

Author SHA1 Message Date
Nyall Dawson
96db7ad4f3 Ensure that all open code editors respond immediately to color/font changes 2020-10-05 13:24:46 +10:00
Nyall Dawson
527e8850ef Add universal last-resort signal QgsGui::optionsChanged()
This signal is emitted whenever the application options have been changed.

This signal is a "blanket" signal, and will be emitted whenever the options dialog
has been accepted regardless of whether or not individual settings are changed.
It is designed as a "last resort" fallback only, allowing widgets to respond
to possible settings changes.
2020-10-05 13:24:46 +10:00
Nyall Dawson
47236421af [needs-docs] Move Python Console settings for font colors and family
to new "Code Editor" tab in options dialog

These settings apply to more than just the Python console editors -
rather they apply to all code editors across QGIS (including expression
editors)
2020-10-05 13:24:46 +10:00
Nyall Dawson
e2ff63da48 Copy font setting logic from QgsPythonConsoleBase to QgsCodeEditor 2020-10-05 13:24:46 +10:00
Nyall Dawson
28245ef32b Add utility class for automatic scope handling for app options widget factories 2020-10-05 13:24:46 +10:00
Nyall Dawson
483c4cde71 Move qgsoptions.cpp to new app/options subdirectory 2020-10-05 13:24:46 +10:00
Julien Cabieces
55c0f93c5d Fixes #39031 : commitData on scale changed for advanced snap
configuration min/max scale
2020-10-05 12:23:18 +10:00
Richard Duivenvoorde
163941cad5 Update to_interval function examples 2020-10-05 12:22:22 +10:00
Richard Duivenvoorde
6420854bdd Make example fit to real output 2020-10-05 12:22:22 +10:00
Richard Duivenvoorde
51b650afdf Show some more diverse format for an interval
Before showing an interval of two hours would show you:
interval: 0.0833333 days
Now depending on the range of the interval you will see output
in days, minutes or seconds:

make_interval(years:=0.75)
<interval: 273.938 days>

make_interval(days:=2, hours:=3)
<interval: 2.125 days>

make_interval(hours:=3,days:=1)
<interval: 1.125 days>

make_interval(minutes:=30)
<interval: 30 minutes>

make_interval(minutes:=0.5,seconds:=5)
<interval: 35 seconds>
2020-10-05 12:22:22 +10:00
Richard Duivenvoorde
667af7f29f Remove obsolete comment 2020-10-05 12:22:22 +10:00
Even Rouault
44466a3322 Code linting: modify "if ( foo() ) { foo()->bar }"-like constructs
cppcheck sometimes detects this as a potential null pointer dereference.
This makes sense, although it is quite unlikely that the return a foo()
might change in between.

To avoid such warnings, and also repeated method calls which can have some
cost, I've run the following refactoring script to store the result of
foo() in a local variable.

```shell
for i in `find ../src -name "*.cpp"`; do python analyze.py $i > $i.tmp; diff $i.tmp $i >/dev/null || (echo "Paching $i"; mv $i.tmp $i); rm -f $i.tmp; done
```

with analyze.py being

```python
import re
import sys

lines = [l[0:-1] if l[-1] == '\n' else l for l in open(sys.argv[1], "rt").readlines()]

if_pattern = re.compile("(^[ ]*)if \( ([a-zA-Z0-9_\.]+)\(\) \)$")

i = 0
while i < len(lines):
    line = lines[i]
    modified = False

    m = if_pattern.match(line)
    if m:
        next_line = lines[i+1]
        indent = m.group(1)
        s = m.group(2) + "()"
        tmpVar = m.group(2).split('.')[-1]
        tmpVar = 'l' + tmpVar[0].upper() + tmpVar[1:]

        if next_line == indent + '{':
            found = False

            # Look in the block after the if() for a pattern where we dereference
            # "foo()"
            j = i + 1
            while lines[j] != indent + '}':
                if lines[j].find(s + '->') >= 0 or lines[j].find('*' + s) >= 0 or lines[j].find(s + '[') >= 0:
                    found = True
                    break
                j += 1

            if found:
                print(indent + 'if ( auto *' + tmpVar + ' = ' + s +  ' )')
                j = i + 1
                while lines[j] != indent + '}':
                    print(lines[j].replace(' ' + s, ' ' + tmpVar).replace('.' + s, '.' + tmpVar).replace('*' + s, '*' + tmpVar).replace('!' + s, '!' + tmpVar))
                    j += 1
                print(lines[j])
                modified = True
                i = j

        else:
            if next_line.find(s) >= 0:
                print(indent + 'if ( auto *' + tmpVar + ' = ' + s +  ' )')
                print(next_line.replace(' ' + s, ' ' + tmpVar).replace('.' + s, '.' + tmpVar).replace('*' + s, '*' + tmpVar).replace('!' + s, '!' + tmpVar))
                modified = True
                i += 1

    if not modified:
        print(line)
    i += 1
```
2020-10-05 12:12:04 +10:00
Julien Cabieces
a3c4fe44ab Fixes #38979 : Fix oracle new connection greyed ok button 2020-10-05 11:57:26 +10:00
Harrissou Sant-anna
7f8c0365b1 Fix tab order
fixes #39161
2020-10-05 04:54:23 +10:00
Salvatore Larosa
2cf6d11997 [pyqgis-console] revert changes for handy commands 2020-10-04 13:19:26 +10:00
Salvatore Larosa
f724793cf0 [pyqgis-console] a better attribute name 2020-10-04 13:19:26 +10:00
Salvatore Larosa
74631215e6 [pyqgis-console] fix missing import 2020-10-04 13:19:26 +10:00
Salvatore Larosa
8533d9a89b [pyqgis-console] restore the correct prompt 2020-10-04 13:19:26 +10:00
Harrissou Sant-anna
3b811bda9f Add more conversion to Qgs(Double)SpinBox 2020-10-04 07:12:52 +10:00
Harrissou Sant-anna
fd8a1e7ac1 Add editor widgets to grass provider 2020-10-04 07:12:52 +10:00
Harrissou Sant-anna
75fc0b5cb7 cleanup 2020-10-04 07:12:52 +10:00
Harrissou Sant-anna
602a775b61 Move widgets from QSpinBox to QgsSpinBox 2020-10-04 07:12:52 +10:00
Harrissou Sant-anna
19acc15de9 Move widgets from QDoubleSpinBox to QgsDoubleSpinBox 2020-10-04 07:12:52 +10:00
Alessandro Pasotti
8cd40aeebf
Merge pull request #39135 from elpaso/bugfix-gh39086-empty-report-crash
Fix crash when exporting empty report
2020-10-03 23:06:55 +02:00
Alessandro Pasotti
beaf4307ec
Merge pull request #39141 from elpaso/bugfix-gh39025-fix-layer-dependency-loading
Fix broken layer dependencies for old projects
2020-10-03 23:06:12 +02:00
Nyall Dawson
5ed37da0b8 Don't hardcode font family for python editor line numbers 2020-10-04 05:02:57 +10:00
Nyall Dawson
ad946d45c8 Ensure colors in Python console match colors for Python editors
used elsewhere in the application
2020-10-04 05:02:57 +10:00
Nyall Dawson
89ace9aeca QgsPythonConsoleBase should use the standard QgsCodeEditorPython
class as a base class

Actually it should be completely folded into QgsCodeEditorPython
so that we have a single definitive Python code editor widget, but
this is a first step toward that...
2020-10-04 05:02:57 +10:00
Alessandro Pasotti
0580e9eb76
Merge pull request #39154 from elpaso/bugfix-gh37666-no-geometry-in-fields
Fix DB manager does not show geography in query results
2020-10-03 11:59:54 +02:00
Nyall Dawson
6078fe4842 Cleanup color handling in QgsCodeEditor classes
Remove a bunch of duplicate default color definitions, and ensure
that all subclasses correctly respect any user defined color overrides,
yet that we still default to following the application theme's matching
color schemes.
2020-10-03 19:58:50 +10:00
nirvn
b7c28df02a [processing] Add missing layers overwrite parameter to two layout exports algorithms 2020-10-03 19:07:35 +10:00
Alessandro Pasotti
b0189b4149 Return a proper QgsProviderConnectionException from python table()
Fixes #39151
2020-10-03 19:06:05 +10:00
Salvatore Larosa
096aa95ac7
Merge pull request #39153 from slarosa/fix_attribute_error
[pyqgis-console] fix instance attribute name
2020-10-03 10:54:05 +02:00
Alessandro Pasotti
ad96c991fc Fix DB manager does not show geography in query results
Fixes #37666
2020-10-03 09:33:59 +02:00
Salvatore Larosa
7c476d176a [pyqgis-console] fix instance attibute name 2020-10-03 08:46:35 +02:00
Salvatore Larosa
f32725658f [pyqgis-console] fix missing import, amd minor fixws to UI 2020-10-03 09:11:32 +10:00
Salvatore Larosa
4fea3ed822 [pyqgis-console] move console options to main app options 2020-10-03 09:11:32 +10:00
Alessandro Pasotti
61a71a417d
Merge pull request #39033 from uclaros/fix-report-bug
Avoid accessing QgsLayoutItemsListView's model before it is defined
2020-10-02 23:29:07 +02:00
Alessandro Pasotti
375a258eda
Merge pull request #39144 from elpaso/bugfix-gh39142-pgraster-float-nodata
PG raster fix #39142 nodata float
2020-10-02 22:32:21 +02:00
vcloarec
6de82d62b7 change return type of QgsGrassRasterProvider::clone() 2020-10-03 05:57:18 +10:00
vcloarec
299709994d change return type of QgsRasterDataProvider::clone() 2020-10-03 05:57:18 +10:00
Alessandro Pasotti
65e8776a9f PG raster fix #39142 nodata float 2020-10-02 20:45:04 +02:00
Alessandro Pasotti
377e5e23ec Fix broken layer dependencies for old projects
Fixes #39025 by skipping the broken relations detection
for widget configuations that were created before weak
relations were introduced and add an extra check for
projects that were created before recent fixes in 3.15
with commit 7e8c7b3d0e09
2020-10-02 17:52:02 +02:00
Even Rouault
ad6254a7b2
Merge pull request #39122 from rouault/cppcheck_20201001
Some cppcheck linting with cppcheck master
2020-10-02 17:51:31 +02:00
Alessandro Pasotti
c45d7a4a4f Fix crash when exporting empty report
Fixes #39086
2020-10-02 13:15:04 +02:00
Even Rouault
88c4ee8764
qgsdelimitedtextprovider.cpp: make code more readable to avoid false positive from cppcheck 2020-10-02 12:08:58 +02:00
Even Rouault
97e2e5e87e
QgsMapLayer: make it obvious to cppcheck that nullptr deref cannot occur, and make code slightly more efficient 2020-10-02 12:08:58 +02:00
Even Rouault
b993fbda79
QgsProject: make it obvious to cppcheck that class is non-copyable/non-affectable 2020-10-02 12:08:57 +02:00
Even Rouault
863c9e3b29
qgsproxyprogresstask_followup 2020-10-02 12:08:57 +02:00
Even Rouault
7ee62d4386
QgsScopedProxyProgressTask: make class non-copyable/non-affectable as it has pointers (but cannot be enabled because of SIP issue) 2020-10-02 12:08:39 +02:00