I have a CListBox with a View of type List. It has only one column that the View of type List splits.
I need to draw a border around each Item .
The column contains a blank icon with size 1 and the text.
How can I draw the box ?
Thanks.
Try adding style LVS_EX_GRIDLINES.
Related
Extracting text of the selected QComboBox item is well known, but how do I get the text in a QComboBox for an arbitrary index item (not necessarily the one selected)?
Use itemText() method to do this. Just set needed index.
As Marek R pointed, you can get model and get data from this model, but it will be helpful for you when you want to get something more than text( for example get image with Qt::DecorationRole or font with Qt::FontRole)
http://qt-project.org/doc/qt-4.8/qcombobox.html#itemText
http://qt-project.org/doc/qt-4.8/qcombobox.html#model
I have a QListView with a model that I am inserting data into. I'm inserting data at the start of the list which causes all the items in the view to scroll down.
What would be the best way to scroll the view automatically to keep the view fixed (i.e the view should move with the visible items as new items are inserted in the model)?
This seems to work. The problem was not actually scrolling to the specific index - it was finding the correct index in the first place.
The following code scrolls the view to keep the same items in the view when inserting at the start of the list. It also checks if the view is at the top of the list and does not scroll in this case.
QScrollBar *pVerticalScrollBar = m_pUi->listView->verticalScrollBar();
bool bScrolledToTop = pVerticalScrollBar->value() == pVerticalScrollBar->minimum();
int iRowIndex = m_pUi->listView->indexAt(QPoint(8, 8)).row();
int iRowCount = m_pInfoListModel->rowCount();
/*
insert text into m_pInfoListModel here
*/
// move scroll bar to keep current items in view (if not scrolled to the top)
if (bScrolledToTop == false)
{
iRowCount = m_pInfoListModel->rowCount() - iRowCount;
m_pUi->listView->scrollTo(m_pInfoListModel->index(iRowIndex + iRowCount, 0), QAbstractItemView::PositionAtTop);
}
This gives me a list of items that scroll by if I am at the top of the list, but when I wan't to look at items lower down the view stays fixed.
I guess you could give setAutoScroll(True) to QListView instance.
I would do the following:
Find the list view item that I want to keep visible and than get its coordinates using
QRect QAbstractItemView::visualRect(const QModelIndex &index)
Than with the item's coordinates I will call QScrollArea::ensureVisible(int, int, int, int) function to keep the item visible after adding each new item to the list.
Is there a way in any language written for OSX (Applescript, C++, etc.) where
I can access the function (adjust column width) in the context menu, when you right
click on the two lines at the bottom of the Scrollbar in Finders Column
View (AXMenu->AXMenuItem)?
Same happens if you double click on the two lines.
Because what I want to do is somehow get a shortcut on this function for "super-fast-
finder-workflows".
From the Finder Applescript Library:
column view options: the column view options
properties
text size (integer) : the size of the text displayed in the column view
shows icon (boolean) : displays an icon next to the label in column view
shows icon preview (boolean) : displays a preview of the item in column view
shows preview column (boolean) : displays the preview column in column view
discloses preview pane (boolean) : discloses the preview pane of the preview column in column view
It doesn't look like Applescript contains a way to access the settings you are looking for
I want an expression tho show the square box around every entry inside a column.
I am getting a normal table view right now. I just want to seperate each row borders.
.i.e. Cell spacing.
Please help me in using cell spacing with report builder 3.0
In addition to resolve this issue do the following steps:
Add one more row above & below to the Data Row & adjust the height for row as 0.2 in(Approximately - Can you add it more as your wishlist).
Then set the background Color using the expression where you want to display a square box as follows,
If you want to match any conditions,
=Switch(Condition = Value_1, "Red",Condition = Value_2, "#D2D2D2",True, "No Color")
otherwise specify color names or code, red, etc.
I have a GridView that displays data in up to 30 columns. Sometimes this has the effect that the gridview expand to a width that requre a horizontal scrollbar but not always. The length of the data in the columns also vary and I don't want to set a specific width, it's nice that the grid is small if half of the columns are empty.
The problem is when I enter edit mode, labels gets replaced by textboxes and those take up more width and the whole table resizes itself.
Is there any way I can keep the item template and it's labels without a fixed size but at the same time always make sure the edit template will have the same size.
I was thinking about something like this:
On "enter edit mode event"
EditTemplateTextBox.Width = CurrentItemTemplate.Width;
I was able to keep my GridView from resizing when switched to edit mode (except for the new "Update" and "Cancel" columns that get added) using this CSS:
table input
{
width: 95%;
}
You can use 100% if you want, but 95% gave a little bit of spacing between the cells.
Also, if you have other tables on the page that you don't want to be affected by this, give your GridView a CssClass and replace 'table' with the name of your css class like so:
<asp:GridView ... CssClass="myGridView">
.myGridView input
{
width: 95%;
}