12 |
12 |
13 class StackedUrlBar(QStackedWidget): |
13 class StackedUrlBar(QStackedWidget): |
14 """ |
14 """ |
15 Class implementing a widget to stack URL bars. |
15 Class implementing a widget to stack URL bars. |
16 """ |
16 """ |
|
17 |
17 def __init__(self, parent=None): |
18 def __init__(self, parent=None): |
18 """ |
19 """ |
19 Constructor |
20 Constructor |
20 |
21 |
21 @param parent reference to the parent widget (QWidget) |
22 @param parent reference to the parent widget (QWidget) |
22 """ |
23 """ |
23 super().__init__(parent) |
24 super().__init__(parent) |
24 |
25 |
25 sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, |
26 sizePolicy = QSizePolicy( |
26 QSizePolicy.Policy.Preferred) |
27 QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred |
|
28 ) |
27 sizePolicy.setHorizontalStretch(6) |
29 sizePolicy.setHorizontalStretch(6) |
28 sizePolicy.setVerticalStretch(0) |
30 sizePolicy.setVerticalStretch(0) |
29 self.setSizePolicy(sizePolicy) |
31 self.setSizePolicy(sizePolicy) |
30 self.setMinimumSize(200, 22) |
32 self.setMinimumSize(200, 22) |
31 |
33 |
32 def currentUrlBar(self): |
34 def currentUrlBar(self): |
33 """ |
35 """ |
34 Public method to get a reference to the current URL bar. |
36 Public method to get a reference to the current URL bar. |
35 |
37 |
36 @return reference to the current URL bar (UrlBar) |
38 @return reference to the current URL bar (UrlBar) |
37 """ |
39 """ |
38 return self.urlBar(self.currentIndex()) |
40 return self.urlBar(self.currentIndex()) |
39 |
41 |
40 def urlBar(self, index): |
42 def urlBar(self, index): |
41 """ |
43 """ |
42 Public method to get a reference to the URL bar for a given index. |
44 Public method to get a reference to the URL bar for a given index. |
43 |
45 |
44 @param index index of the url bar (integer) |
46 @param index index of the url bar (integer) |
45 @return reference to the URL bar for the given index (UrlBar) |
47 @return reference to the URL bar for the given index (UrlBar) |
46 """ |
48 """ |
47 return self.widget(index) |
49 return self.widget(index) |
48 |
50 |
49 def moveBar(self, from_, to_): |
51 def moveBar(self, from_, to_): |
50 """ |
52 """ |
51 Public slot to move an URL bar. |
53 Public slot to move an URL bar. |
52 |
54 |
53 @param from_ index of URL bar to be moved (integer) |
55 @param from_ index of URL bar to be moved (integer) |
54 @param to_ index to move the URL bar to (integer) |
56 @param to_ index to move the URL bar to (integer) |
55 """ |
57 """ |
56 fromBar = self.widget(from_) |
58 fromBar = self.widget(from_) |
57 self.removeWidget(fromBar) |
59 self.removeWidget(fromBar) |
58 self.insertWidget(to_, fromBar) |
60 self.insertWidget(to_, fromBar) |
59 |
61 |
60 def urlBars(self): |
62 def urlBars(self): |
61 """ |
63 """ |
62 Public method to get a list of references to all URL bars. |
64 Public method to get a list of references to all URL bars. |
63 |
65 |
64 @return list of references to URL bars (list of UrlBar) |
66 @return list of references to URL bars (list of UrlBar) |
65 """ |
67 """ |
66 urlBars = [] |
68 urlBars = [] |
67 for index in range(self.count()): |
69 for index in range(self.count()): |
68 urlBars.append(self.widget(index)) |
70 urlBars.append(self.widget(index)) |