I'm very new to GIS technology and have been trying to learn qGIS through downloaded tutorials. My qGIS is the 2.14.21 version. It was going well until the instructions told me to edit the attribute table of one of my layers (a sqlite layer with a polygon geometry type). The edit button is 'greyed' out, not allowing me to access this function. Why is this? I have tried various ways of selecting the data, restarting the program, and accessing the table through different buttons. The 'add a new field' button is also greyed, though the field calculator is functional. My online research hasn't come up with answers yet.
This can happen if you don't have permission to edit the layer. Outside of QGIS, open the folder that the layer is in, right-click on the layer, and open Properties > Security. Where it says "Permissions for [username]" there should be a check next to "Modify" and "Write." If not, change the permissions for that file. If you don't have permission to change the permissions (a rather infuriating logic loop), save a copy of the layer to a folder that you can edit, and work from the copy.
I had the same and had to save the imported maplayer first under a different file-name.
Select the greyed-out maplayer in your main map screen. From toprow: Maplayer > save as ... (somewhere in the middle of the menu) write down a filename. Browse to a map with the three dots on the right.
Mark the checkbox "add saved file to the map". press OK. Back in your main map screen, you have both maps. The first is still with the greyed-out attribute table. The new one is editable.
I had the same issue when I added the shapefile by Add vector layer - browsed to a zip file and then selected the shapefiles it offered. When I unzipped it, went to Add vector layer and directly selected the shapefile I want to add (as opposed to the zip file), the Toggle Edit option became active.
I have come across this issue. The easiest way worked with me is check if you have primary key in your data. If not, add one and reload the feature and try editing. But because shapefile does not have a primary key concept, you can use field calculator to create a column that utilizes row or record number as its value.